zhtaoxiang commented on code in PR #9954:
URL: https://github.com/apache/pinot/pull/9954#discussion_r1048876709
##########
pinot-common/src/main/java/org/apache/pinot/common/minion/MinionTaskMetadataUtils.java:
##########
@@ -63,6 +68,66 @@ private static ZNRecord
fetchTaskMetadata(HelixPropertyStore<ZNRecord> propertyS
return znRecord;
}
+ /**
+ * Gets the last update time (in ms) of all minion task metadata.
+ * @param propertyStore the property store where all minion task metadata is
stored.
+ * @return a map storing the last update time (in ms) of all minion task
metadata: (tableNameWithType -> taskType
+ * -> last update time in ms)
+ */
+ @Nonnull
+ public static Map<String, Map<String, Long>>
getAllTaskMetadataLastUpdateTimeMs(
+ @Nonnull HelixPropertyStore<ZNRecord> propertyStore) {
+ Map<String, Map<String, Long>> tableTaskLastUpdateTimeMsMap = new
HashMap<>();
+ String propertyStorePathForMinionTaskMetadataPrefix =
+ ZKMetadataProvider.getPropertyStorePathForMinionTaskMetadataPrefix();
+ // the old and new path may exist at the same time
+ List<String> tableNameWithTypeOrTaskTypes =
+
propertyStore.getChildNames(propertyStorePathForMinionTaskMetadataPrefix,
AccessOption.PERSISTENT);
+ if (tableNameWithTypeOrTaskTypes == null ||
tableNameWithTypeOrTaskTypes.isEmpty()) {
+ return tableTaskLastUpdateTimeMsMap;
+ }
+ for (String tableNameWithTypeOrTaskType : tableNameWithTypeOrTaskTypes) {
+ String metadataNodeDirectParentPath =
+ StringUtil.join("/", propertyStorePathForMinionTaskMetadataPrefix,
tableNameWithTypeOrTaskType);
+ List<String> metadataNodeNames =
+ propertyStore.getChildNames(metadataNodeDirectParentPath,
AccessOption.PERSISTENT);
+ if (metadataNodeNames == null || metadataNodeNames.isEmpty()) {
+ continue;
+ }
+ // the new path is MINION_TASK_METADATA/${tableNameWthType}/${taskType}
+ // the old path is MINION_TASK_METADATA/${taskType}/${tableNameWthType}
+ boolean isNewPath =
Review Comment:
The variable `tableNameWithTypeOrTaskType` stores the first level child name
of `MINION_TASK_METADATA`, that why when it ends with `OFFLINE` or `REALTIME`,
it is a new path.
Let me add this explanation to make it clearer.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]