jackjlli commented on code in PR #9339:
URL: https://github.com/apache/pinot/pull/9339#discussion_r965335338
##########
pinot-common/src/main/java/org/apache/pinot/common/minion/MinionTaskMetadataUtils.java:
##########
@@ -79,10 +80,38 @@ public static void
deleteTaskMetadata(HelixPropertyStore<ZNRecord> propertyStore
}
}
+ /**
+ * Deletes the minion task metadata ZNRecord for the given tableName, from
both the new path
+ * MINION_TASK_METADATA/${tableNameWthType} and the old path
+ * MINION_TASK_METADATA/<any task type>/${tableNameWthType}
+ */
+ public static void deleteTaskMetadata(HelixPropertyStore<ZNRecord>
propertyStore, String tableNameWithType) {
+ // delete the minion task metadata ZNRecord
MINION_TASK_METADATA/${tableNameWthType}
+ String path =
ZKMetadataProvider.constructPropertyStorePathForMinionTaskMetadata(tableNameWithType);
+ if (!propertyStore.remove(path, AccessOption.PERSISTENT)) {
+ throw new ZkException("Failed to delete task metadata for table: " +
tableNameWithType);
+ }
+ // delete the minion task metadata ZNRecord MINION_TASK_METADATA/<any task
type>/${tableNameWthType}
+ List<String> childNames =
+
propertyStore.getChildNames(ZKMetadataProvider.getPropertyStorePathForMinionTaskMetadataPrefix(),
+ AccessOption.PERSISTENT);
+ if (childNames != null && !childNames.isEmpty()) {
+ for (String child : childNames) {
+ // Even though some child names are not task types (e.g., in the new
metadata path, the child name
+ // is a table name), it does not harm to try to delete the
non-existent constructed path.
+ String oldPath =
+
ZKMetadataProvider.constructPropertyStorePathForMinionTaskMetadataDeprecated(child,
tableNameWithType);
+ if (!propertyStore.remove(oldPath, AccessOption.PERSISTENT)) {
Review Comment:
Oh nvm, saw the source code in helix-core jar. I feel the better approach
would be to traverse all the existing task types instead of going over all the
children nodes (there could be thousands of tables in a cluster), but for now
I'm fine with this. You can add a TODO 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.
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]