NealSun96 commented on a change in pull request #1413:
URL: https://github.com/apache/helix/pull/1413#discussion_r496292296
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/dataproviders/BaseControllerDataProvider.java
##########
@@ -728,6 +756,41 @@ private void updateDisabledInstances() {
}
}
+ /*
+ * Check if the instance is timed-out during maintenance mode. An instance
is timed-out if it has
+ * been offline for longer than the user defined timeout window.
+ * @param timeOutWindow - the timeout window; guaranteed to be non-negative
+ */
+ private boolean isInstanceTimedOutDuringMaintenance(HelixDataAccessor
accessor, String instance,
+ long timeOutWindow) {
+ PropertyKey.Builder keyBuilder = accessor.keyBuilder();
+ PropertyKey propertyKey = keyBuilder.participantHistory(instance);
+ ParticipantHistory history = accessor.getProperty(propertyKey);
+
+ // Cannot use _instanceOfflineTimeMap. _instanceOfflineTimeMap is last
updated in the previous
+ // pipeline execution; it is possible a new offline timestamp is updated
after the previous
+ // pipeline execution, so we need the most updated timestamp.
+ long lastOfflineTime = history.getLastTimeInOfflineHistory();
+ // lastOfflineTime is only negative if there is no offline history or the
time format is wrong.
+ // Since this instance is a 'new' live instance, not having offline
history = first time created
+ // instance; during maintenance mode, no partition will be assigned to
such a new instance,
+ // therefore it's okay to no time it out. The wrong format case shouldn't
happen at all and will
+ // not be handled either.
+ if (lastOfflineTime < 0) {
Review comment:
This isn't the actual `LAST_OFFLINE_TIME` field in History; I can
understand the confusion due to variable name.
I implemented a new function called `getLastTimeInOfflineHistory()` where
the latest date in `OFFLINE` is returned. In the case when that cannot be
returned, -1 will be the error indicator; you could refer the comment above for
more detail.
----------------------------------------------------------------
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]