Skip to content

Commit

Permalink
[ISSUE apache#2334] Polish the log and response remark when service n…
Browse files Browse the repository at this point in the history
…ot available (apache#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
  • Loading branch information
RongtongJin authored Oct 12, 2020
1 parent 77d24de commit c932941
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,29 @@ private void handlePutMessageResult(PutMessageResult putMessageResult,

// 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;
case MESSAGE_ILLEGAL:
log.info(
log.warn(
"the message is illegal, maybe msg properties length limit 32k.");
break;
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.");
break;
case SERVICE_NOT_AVAILABLE:
log.info(
"service not available now, maybe disk full, maybe your broker machine memory too small.");
log.warn(
"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;
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;
case UNKNOWN_ERROR:
log.info("UNKNOWN_ERROR");
log.warn("UNKNOWN_ERROR");
break;
default:
log.info("UNKNOWN_ERROR DEFAULT");
log.warn("UNKNOWN_ERROR DEFAULT");
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ private RemotingCommand handlePutMessageResult(PutMessageResult putMessageResult
case SERVICE_NOT_AVAILABLE:
response.setCode(ResponseCode.SERVICE_NOT_AVAILABLE);
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;
case OS_PAGECACHE_BUSY:
response.setCode(ResponseCode.SYSTEM_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,16 @@ private PutMessageStatus checkStoreStatus() {
if (BrokerRole.SLAVE == this.messageStoreConfig.getBrokerRole()) {
long value = this.printTimes.getAndIncrement();
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;
}

if (!this.runningFlags.isWriteable()) {
long value = this.printTimes.getAndIncrement();
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;
} else {
Expand Down

0 comments on commit c932941

Please sign in to comment.