jiajunwang commented on a change in pull request #1487:
URL: https://github.com/apache/helix/pull/1487#discussion_r520261433
##########
File path: helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
##########
@@ -492,47 +496,39 @@ void publishStatusUpdateRecord(ZNRecord record, Message
message, Level level,
Builder keyBuilder = accessor.keyBuilder();
if (!_recordedMessages.containsKey(message.getMsgId())) {
- if (isController) {
- accessor
-
.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
statusUpdateKey),
- new StatusUpdate(createMessageLogRecord(message)));
+ ZNRecord statusUpdateRecord = createMessageLogRecord(message);
+ PropertyKey propertyKey;
+ if (isController) {
+ propertyKey = keyBuilder.controllerTaskStatus(statusUpdateSubPath,
statusUpdateKey);
+ accessor.updateProperty(propertyKey, new
StatusUpdate(statusUpdateRecord));
Review comment:
nit, we can move this line out of the if-else block too.
##########
File path: helix-common/src/main/java/org/apache/helix/SystemPropertyKeys.java
##########
@@ -82,4 +82,6 @@
// System Property Metadata Store Directory Server endpoint key
public static final String MSDS_SERVER_ENDPOINT_KEY =
MetadataStoreRoutingConstants.MSDS_SERVER_ENDPOINT_KEY;
+
+ public static final String STATEUPDATEUTIL_ERROR_LOG2ZK_ENABLED =
"helix.StateUpdateUtil.errorLog.enabled";
Review comment:
I thought more about this configuration. Can we directly make it an enum
now instead of changing it later? Otherwise, we will need to deprecate this
item and go through the painful backward compatibility checklist in the future.
I suggest making it STATEUPDATE_ERROR_REPORTING_CHANNEL.
##########
File path: helix-core/src/main/java/org/apache/helix/util/StatusUpdateUtil.java
##########
@@ -492,47 +496,39 @@ void publishStatusUpdateRecord(ZNRecord record, Message
message, Level level,
Builder keyBuilder = accessor.keyBuilder();
if (!_recordedMessages.containsKey(message.getMsgId())) {
- if (isController) {
- accessor
-
.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
statusUpdateKey),
- new StatusUpdate(createMessageLogRecord(message)));
+ ZNRecord statusUpdateRecord = createMessageLogRecord(message);
+ PropertyKey propertyKey;
+ if (isController) {
+ propertyKey = keyBuilder.controllerTaskStatus(statusUpdateSubPath,
statusUpdateKey);
+ accessor.updateProperty(propertyKey, new
StatusUpdate(statusUpdateRecord));
} else {
-
- PropertyKey propertyKey =
+ propertyKey =
keyBuilder.stateTransitionStatus(instanceName, sessionId,
statusUpdateSubPath,
statusUpdateKey);
-
- ZNRecord statusUpdateRecord = createMessageLogRecord(message);
-
- // For now write participant StatusUpdates to log4j.
- // we are using restlet as another data channel to report to
controller.
- if (_logger.isTraceEnabled()) {
- _logger.trace("StatusUpdate path:" + propertyKey.getPath() + ",
updates:"
- + statusUpdateRecord);
- }
accessor.updateProperty(propertyKey, new
StatusUpdate(statusUpdateRecord));
+ }
+ if (_logger.isTraceEnabled()) {
+ _logger.trace("StatusUpdate path:" + propertyKey.getPath() + ",
updates:"
+ + statusUpdateRecord);
}
_recordedMessages.put(message.getMsgId(), message.getMsgId());
}
+ PropertyKey propertyKey;
if (isController) {
- accessor.updateProperty(
- keyBuilder.controllerTaskStatus(statusUpdateSubPath,
statusUpdateKey), new StatusUpdate(
- record));
+ propertyKey = keyBuilder.controllerTaskStatus(statusUpdateSubPath,
statusUpdateKey);
+ accessor.updateProperty(propertyKey, new StatusUpdate(record));
Review comment:
same here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]