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

Skip task validation during table creation with schema #14683

Merged

Conversation

xiangfu0
Copy link
Contributor

@xiangfu0 xiangfu0 commented Dec 18, 2024

How to reproduce:
Create a realtime table along with schema using the pinot-admin AddTable command. The table config should contain the task: RealtimeToOfflineSegmentsTask.

Reason:
For the table creation with schema, the task config validation might fail due to some tasks validation requires schema which is null when calling from the zookeeper.

The fix is to skip the task validation before the schema upload then validate it again.

The ultimate fix is to change the TaskGenerator interface to put both schema and tableConfig in it.

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.85%. Comparing base (59551e4) to head (3ea90c8).
Report is 1549 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14683      +/-   ##
============================================
+ Coverage     61.75%   63.85%   +2.09%     
- Complexity      207     1608    +1401     
============================================
  Files          2436     2704     +268     
  Lines        133233   150926   +17693     
  Branches      20636    23318    +2682     
============================================
+ Hits          82274    96368   +14094     
- Misses        44911    47345    +2434     
- Partials       6048     7213    +1165     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.82% <100.00%> (+2.11%) ⬆️
java-21 63.73% <100.00%> (+2.11%) ⬆️
skip-bytebuffers-false 63.84% <100.00%> (+2.09%) ⬆️
skip-bytebuffers-true 63.71% <100.00%> (+35.98%) ⬆️
temurin 63.85% <100.00%> (+2.09%) ⬆️
unittests 63.84% <100.00%> (+2.09%) ⬆️
unittests1 56.29% <ø> (+9.40%) ⬆️
unittests2 34.13% <100.00%> (+6.40%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@shounakmk219 shounakmk219 left a comment

Choose a reason for hiding this comment

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

We should also handle this case in /tableConfigs/validate endpoint. But problem there is we cannot revalidate it as schema is never registered.
IMO let's just add the new interface method with schema parameter and deprecate the existing one as its only introduced last month so hopefully the usage is limited

// Skip validate task type for table creation as the schema is not yet registered.
validateConfig(tableConfigs, databaseName, "TASK");
} else {
validateConfig(tableConfigs, databaseName, typesToSkip);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should append ",TASK" here to typesToSkip?
Looks like typesToSkip string is not parsed properly in validateTaskConfigs and assumed that only one type is passed while the endpoint expects comma separated list of types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, there is only full string match inside, I feel some parsing logic is wrong there.


if (typesToSkip == null) {
// Validate config again with schema for validations requires schema.
validateConfig(tableConfigs, databaseName, null);
Copy link
Collaborator

@shounakmk219 shounakmk219 Dec 18, 2024

Choose a reason for hiding this comment

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

Do we need to revert the schema creation upon validation failure as it will fail the request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, the catch clause will revert.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah sorry missed that

@xiangfu0
Copy link
Contributor Author

We should also handle this case in /tableConfigs/validate endpoint. But problem there is we cannot revalidate it as schema is never registered. IMO let's just add the new interface method with schema parameter and deprecate the existing one as its only introduced last month so hopefully the usage is limited

I'm with you, I think let me make the interface change to allow an optional schema. The validation logic could fetch it from zk if it's null.

@xiangfu0 xiangfu0 force-pushed the skip-table-validation-for-table-creation branch 2 times, most recently from f4bc0fe to 5fce882 Compare December 20, 2024 21:16
@xiangfu0 xiangfu0 force-pushed the skip-table-validation-for-table-creation branch 3 times, most recently from c59305c to f14dc59 Compare December 20, 2024 21:43
Copy link
Collaborator

@shounakmk219 shounakmk219 left a comment

Choose a reason for hiding this comment

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

LGTM

@xiangfu0 xiangfu0 force-pushed the skip-table-validation-for-table-creation branch from f14dc59 to 3ea90c8 Compare January 8, 2025 13:54
@xiangfu0 xiangfu0 merged commit 6b1ccc5 into apache:master Jan 8, 2025
21 checks passed
@xiangfu0 xiangfu0 deleted the skip-table-validation-for-table-creation branch January 8, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants