-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix schema name in table config during controller startup #11574
Fix schema name in table config during controller startup #11574
Conversation
ee7b25b
to
eb503fd
Compare
Codecov Report
@@ Coverage Diff @@
## master #11574 +/- ##
============================================
+ Coverage 63.09% 63.11% +0.01%
Complexity 1117 1117
============================================
Files 2342 2342
Lines 125920 125993 +73
Branches 19370 19377 +7
============================================
+ Hits 79454 79517 +63
- Misses 40812 40818 +6
- Partials 5654 5658 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 14 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
14f5349
to
19e9346
Compare
19e9346
to
0c9aeaa
Compare
0c9aeaa
to
d83ab8f
Compare
We don't really need a periodic task after preventing new table with different schema to be created. It can be done as a one time scan when controller starts |
Actually a periodic task is also fine. We will remove it after one release anyway |
I would say we can keep this job for 1.x release, then remove it in 2.x :) |
@xiangfu0 , I am not able to understand - Why are we needing a periodic task for this , as new tables creation with different schema name is anyways going to blocked . Any problems we encounter by keeping this -
|
My feeling is #11570 may not get merged before this PR :p The purpose is to ensure each table has its own schema, no cross references. |
d83ab8f
to
13dbc83
Compare
6d81401
to
2019605
Compare
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
Show resolved
Hide resolved
843e8bf
to
409974a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for adding the code changes!
004786d
to
fe68a6b
Compare
Rebased to incorporate the changes from #11591 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make the counter more specific:
- Tables without schema
- Misconfigured tables: tables with schema name not matching the raw table name
- Fixed tables
- Failed to copy schema
- Failed to update table config
pinot-controller/src/main/java/org/apache/pinot/controller/ControllerConf.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
Outdated
Show resolved
Hide resolved
MAX_RECORD_AVAILABILITY_LAG_MS("maxRecordAvailabilityLagMs", false), | ||
|
||
// Number of table schema got fixed | ||
FIXED_SCHEMA_TABLE_COUNT("FixedSchemaTableCount", true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have these configs covered in the prometheus yaml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those should be covered by the match all rule
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
Outdated
Show resolved
Hide resolved
pinot-controller/src/main/java/org/apache/pinot/controller/BaseControllerStarter.java
Outdated
Show resolved
Hide resolved
// Update table config to remove schema name | ||
tableConfig.getValidationConfig().setSchemaName(null); | ||
try { | ||
_helixResourceManager.updateTableConfig(tableConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do version check and update. Currently it might override another table config update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to do this in another PR for helixResourceManager API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to change PinotHelixResouceManager
. Actually we should not even use this updateTableConfig()
method, but should use property store instead which can check the versions.
PinotHelixResourceManager.updateTableConfig()
is always overriding the whole table config, instead of changing a field, and that is why version check is not required
fe68a6b
to
d0ea80e
Compare
0eb66f0
to
5e965bd
Compare
return propertyStore.set(constructPropertyStorePathForResourceConfig(tableNameWithType), tableConfigZNRecord, | ||
expectVersion, AccessOption.PERSISTENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part should be outside of the try-catch
* | ||
* @return true if update is successful. | ||
*/ | ||
public static boolean setTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) tableNameWithType
is not needed
TableConfig tableConfig = toTableConfig( | ||
propertyStore.get(constructPropertyStorePathForResourceConfig(tableNameWithType), tableConfigStat, | ||
AccessOption.PERSISTENT)); | ||
return ImmutablePair.of(tableConfig, tableConfigStat.getVersion()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When tableConfig
is null, we should probably directly return null
instead of a pair. Also annotate the return as @Nullable
5e965bd
to
313aa28
Compare
Fix schema name in table config during controller startup: