- 
                Notifications
    
You must be signed in to change notification settings  - Fork 358
 
[AMORO-3810] Fix tableRuntime initialize failed when not have optimizer info for table #3811
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
base: master
Are you sure you want to change the base?
Conversation
…er info for table
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.
Hi,
Thanks for the contribution!
I left a comment, PTAL.
| List<TableRuntimeState> states = statesMap.get(tableRuntimeMeta.getTableId()); | ||
| // if first time states will be null can't be initial table runtime | ||
| if (states == null) { | ||
| TableRuntimeState state = new TableRuntimeState(); | 
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.
Maybe we can just initialize an empty list here, https://github.com/apache/amoro/blob/master/amoro-ams/src/main/java/org/apache/amoro/server/table/DefaultTableRuntimeStore.java#L137 will generate required states and put them in the database.
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.
cc @baiyangtx
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 agree with that.
The initialization of states should be uniformly managed by the lifecycle logic of TableRuntime, and its default values have already been defined in StateKey.
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.
Additionally, stateId and OptimizingStatus are not related. TableRuntimeState represents the persistent access interface of TableRuntime, while OptimizingStatus is part of the optimization logic of Iceberg and Mixed Iceberg. The two are unrelated.
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 we persist tableuntime for the first time, do we need to set OptimizingStatus to IDLE by default? Or will the subsequent optimization triggers automatically supplement this status cc @baiyangtx @zhoujinsong
| List<TableRuntimeState> states = statesMap.get(tableRuntimeMeta.getTableId()); | ||
| // if first time states will be null can't be initial table runtime | ||
| if (states == null) { | ||
| TableRuntimeState state = new TableRuntimeState(); | 
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 agree with that.
The initialization of states should be uniformly managed by the lifecycle logic of TableRuntime, and its default values have already been defined in StateKey.
| List<TableRuntimeState> states = statesMap.get(tableRuntimeMeta.getTableId()); | ||
| // if first time states will be null can't be initial table runtime | ||
| if (states == null) { | ||
| TableRuntimeState state = new TableRuntimeState(); | 
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.
Additionally, stateId and OptimizingStatus are not related. TableRuntimeState represents the persistent access interface of TableRuntime, while OptimizingStatus is part of the optimization logic of Iceberg and Mixed Iceberg. The two are unrelated.
Fix tableRuntime initialize failed when not have optimizer info for table
Why are the changes needed?
Close #3810.
Brief change log
How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate
Run test locally before making a pull request
Documentation