未验证 提交 c932941f 编写于 作者: R rongtong 提交者: GitHub

[ISSUE #2334] Polish the log and response remark when service not available (#2335)

* enhancement(response & log):polish the log and response remark when service not available

* enhancement(response remark & log): make log and response remark better understand

* chore(style): modify code style to pass CI tests
上级 77d24def
...@@ -251,28 +251,29 @@ public class ReplyMessageProcessor extends AbstractSendMessageProcessor implemen ...@@ -251,28 +251,29 @@ public class ReplyMessageProcessor extends AbstractSendMessageProcessor implemen
// Failed // Failed
case CREATE_MAPEDFILE_FAILED: case CREATE_MAPEDFILE_FAILED:
log.info("create mapped file failed, server is busy or broken."); log.warn("create mapped file failed, server is busy or broken.");
break; break;
case MESSAGE_ILLEGAL: case MESSAGE_ILLEGAL:
log.info( log.warn(
"the message is illegal, maybe msg properties length limit 32k."); "the message is illegal, maybe msg properties length limit 32k.");
break; break;
case PROPERTIES_SIZE_EXCEEDED: case PROPERTIES_SIZE_EXCEEDED:
log.info( log.warn(
"the message is illegal, maybe msg body or properties length not matched. msg body length limit 128k."); "the message is illegal, maybe msg body or properties length not matched. msg body length limit 128k.");
break; break;
case SERVICE_NOT_AVAILABLE: case SERVICE_NOT_AVAILABLE:
log.info( log.warn(
"service not available now, maybe disk full, maybe your broker machine memory too small."); "service not available now. It may be caused by one of the following reasons: " +
"the broker's disk is full, messages are put to the slave, message store has been shut down, etc.");
break; break;
case OS_PAGECACHE_BUSY: case OS_PAGECACHE_BUSY:
log.info("[PC_SYNCHRONIZED]broker busy, start flow control for a while"); log.warn("[PC_SYNCHRONIZED]broker busy, start flow control for a while");
break; break;
case UNKNOWN_ERROR: case UNKNOWN_ERROR:
log.info("UNKNOWN_ERROR"); log.warn("UNKNOWN_ERROR");
break; break;
default: default:
log.info("UNKNOWN_ERROR DEFAULT"); log.warn("UNKNOWN_ERROR DEFAULT");
break; break;
} }
......
...@@ -480,7 +480,8 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement ...@@ -480,7 +480,8 @@ public class SendMessageProcessor extends AbstractSendMessageProcessor implement
case SERVICE_NOT_AVAILABLE: case SERVICE_NOT_AVAILABLE:
response.setCode(ResponseCode.SERVICE_NOT_AVAILABLE); response.setCode(ResponseCode.SERVICE_NOT_AVAILABLE);
response.setRemark( response.setRemark(
"service not available now, maybe disk full, " + diskUtil() + ", maybe your broker machine memory too small."); "service not available now. It may be caused by one of the following reasons: " +
"the broker's disk is full [" + diskUtil() + "], messages are put to the slave, message store has been shut down, etc.");
break; break;
case OS_PAGECACHE_BUSY: case OS_PAGECACHE_BUSY:
response.setCode(ResponseCode.SYSTEM_ERROR); response.setCode(ResponseCode.SYSTEM_ERROR);
......
...@@ -392,7 +392,7 @@ public class DefaultMessageStore implements MessageStore { ...@@ -392,7 +392,7 @@ public class DefaultMessageStore implements MessageStore {
if (BrokerRole.SLAVE == this.messageStoreConfig.getBrokerRole()) { if (BrokerRole.SLAVE == this.messageStoreConfig.getBrokerRole()) {
long value = this.printTimes.getAndIncrement(); long value = this.printTimes.getAndIncrement();
if ((value % 50000) == 0) { if ((value % 50000) == 0) {
log.warn("message store has shutdown, so putMessage is forbidden"); log.warn("broke role is slave, so putMessage is forbidden");
} }
return PutMessageStatus.SERVICE_NOT_AVAILABLE; return PutMessageStatus.SERVICE_NOT_AVAILABLE;
} }
...@@ -400,7 +400,8 @@ public class DefaultMessageStore implements MessageStore { ...@@ -400,7 +400,8 @@ public class DefaultMessageStore implements MessageStore {
if (!this.runningFlags.isWriteable()) { if (!this.runningFlags.isWriteable()) {
long value = this.printTimes.getAndIncrement(); long value = this.printTimes.getAndIncrement();
if ((value % 50000) == 0) { if ((value % 50000) == 0) {
log.warn("message store has shutdown, so putMessage is forbidden"); log.warn("the message store is not writable. It may be caused by one of the following reasons: " +
"the broker's disk is full, write to logic queue error, write to index file error, etc");
} }
return PutMessageStatus.SERVICE_NOT_AVAILABLE; return PutMessageStatus.SERVICE_NOT_AVAILABLE;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册