未验证 提交 daf1b9df 编写于 作者: 孙不服 提交者: GitHub

[ISSUE #503] NOT_CONSUME_YET not righht in RocketMQ Console (#3091)

上级 b30bd870
...@@ -28,4 +28,16 @@ public class RemotingUtilTest { ...@@ -28,4 +28,16 @@ public class RemotingUtilTest {
assertThat(localAddress).isNotNull(); assertThat(localAddress).isNotNull();
assertThat(localAddress.length()).isGreaterThan(0); assertThat(localAddress.length()).isGreaterThan(0);
} }
@Test
public void testConvert2IpStringWithIp() {
String result = RemotingUtil.convert2IpString("127.0.0.1:9876");
assertThat(result).isEqualTo("127.0.0.1:9876");
}
@Test
public void testConvert2IpStringWithHost() {
String result = RemotingUtil.convert2IpString("localhost:9876");
assertThat(result).isEqualTo("127.0.0.1:9876");
}
} }
...@@ -165,6 +165,10 @@ public class RemotingUtil { ...@@ -165,6 +165,10 @@ public class RemotingUtil {
return sb.toString(); return sb.toString();
} }
public static String convert2IpString(final String addr) {
return socketAddress2String(string2SocketAddress(addr));
}
private static boolean isBridge(NetworkInterface networkInterface) { private static boolean isBridge(NetworkInterface networkInterface) {
try { try {
if (isLinuxPlatform()) { if (isLinuxPlatform()) {
......
...@@ -888,7 +888,7 @@ public class DefaultMQAdminExtImpl implements MQAdminExt, MQAdminExtInner { ...@@ -888,7 +888,7 @@ public class DefaultMQAdminExtImpl implements MQAdminExt, MQAdminExtInner {
if (mq.getTopic().equals(msg.getTopic()) && mq.getQueueId() == msg.getQueueId()) { if (mq.getTopic().equals(msg.getTopic()) && mq.getQueueId() == msg.getQueueId()) {
BrokerData brokerData = ci.getBrokerAddrTable().get(mq.getBrokerName()); BrokerData brokerData = ci.getBrokerAddrTable().get(mq.getBrokerName());
if (brokerData != null) { if (brokerData != null) {
String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID); String addr = RemotingUtil.convert2IpString(brokerData.getBrokerAddrs().get(MixAll.MASTER_ID));
if (RemotingUtil.socketAddress2String(msg.getStoreHost()).equals(addr)) { if (RemotingUtil.socketAddress2String(msg.getStoreHost()).equals(addr)) {
if (next.getValue().getConsumerOffset() > msg.getQueueOffset()) { if (next.getValue().getConsumerOffset() > msg.getQueueOffset()) {
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册