Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete all related minion task metadata when deleting a table #9339

Merged
merged 10 commits into from
Sep 7, 2022

Conversation

zhtaoxiang
Copy link
Contributor

@zhtaoxiang zhtaoxiang commented Sep 6, 2022

Delete the ZNode
(1) MINION_TASK_METADATA/${tableName} and its descendants
(2) MINION_TASK_METADATA//${tableName}
when deleting a table, so that
(1) we don't need to explicitly delete each MINION_TASK_METADATA/${tableName}/${taskType} and MINION_TASK_METADATA/${taskType}/${tableName} separately.
(2) the code can also delete customized minion task metadata automatically

@zhtaoxiang zhtaoxiang marked this pull request as draft September 6, 2022 23:36
@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2022

Codecov Report

Merging #9339 (f5c4d3d) into master (0f4bcfc) will decrease coverage by 8.50%.
The diff coverage is 84.61%.

@@             Coverage Diff              @@
##             master    #9339      +/-   ##
============================================
- Coverage     69.80%   61.29%   -8.51%     
+ Complexity     4777     4553     -224     
============================================
  Files          1875     1870       -5     
  Lines         99860    99821      -39     
  Branches      15194    15192       -2     
============================================
- Hits          69706    61190    -8516     
- Misses        25231    33991    +8760     
+ Partials       4923     4640     -283     
Flag Coverage Δ
integration1 26.23% <57.69%> (+0.02%) ⬆️
integration2 ?
unittests1 66.91% <77.27%> (-0.18%) ⬇️
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...e/pinot/common/minion/MinionTaskMetadataUtils.java 88.09% <69.23%> (-8.46%) ⬇️
...ache/pinot/common/metadata/ZKMetadataProvider.java 66.66% <100.00%> (-0.75%) ⬇️
...he/pinot/common/utils/helix/FakePropertyStore.java 65.51% <100.00%> (+8.99%) ⬆️
...ntroller/helix/core/PinotHelixResourceManager.java 40.41% <100.00%> (-31.50%) ⬇️
...g/apache/pinot/server/api/resources/ErrorInfo.java 0.00% <0.00%> (-100.00%) ⬇️
...t/core/plan/StreamingInstanceResponsePlanNode.java 0.00% <0.00%> (-100.00%) ⬇️
...pinot/controller/recommender/io/ConfigManager.java 0.00% <0.00%> (-100.00%) ⬇️
...ore/operator/streaming/StreamingResponseUtils.java 0.00% <0.00%> (-100.00%) ⬇️
...server/starter/helix/SegmentReloadStatusValue.java 0.00% <0.00%> (-100.00%) ⬇️
.../org/apache/pinot/client/AggregationResultSet.java 0.00% <0.00%> (-100.00%) ⬇️
... and 383 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jackjlli jackjlli marked this pull request as ready for review September 7, 2022 17:13
Copy link
Member

@jackjlli jackjlli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor but LGTM.

@zhtaoxiang
Copy link
Contributor Author

@jackjlli thanks for reviewing the code. I made some more changes to clean up some redundant. Please help to review the code again when you get some time. Thanks!

// 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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the path doesn't exist, propertyStore.remove() will return false. In this case, an exception will be thrown and the for loop will stop, which contradicts to the comment several lines above though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I tested locally using integration test, if we are trying to remove a non-existent path, it returns true.

Could you please let me know your test setup so I can try it myself? Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have another version implemented locally 😄 , which scans jars and find all minion task types, similar to what https://github.com/apache/pinot/blob/master/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/generator/TaskGeneratorRegistry.java does.

I chose the current one (which reads from ZK) because I want to use ZK as the source of truth, so we will not miss any ZNode.

But you point out a very good point that there might be thousands of tables. I can add a TODO and we can decide later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know your thought, we can switch to the other approach or we can merge the current approach and get back to it later.

(BTW, could you please merge it if we want to go with the current approach as for now because I cannot merge the code 😄 )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get back to it later. I'll merge this one. Thanks for making the change!

@jackjlli jackjlli merged commit cf13b24 into apache:master Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants