Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ public void initialize() {
continue;
}
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();
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

state.setStateId(OptimizingStatus.IDLE.getCode());
state.setTableId(tableRuntimeMeta.getTableId());
states = Collections.singletonList(state);
}
Optional<TableRuntime> tableRuntime =
createTableRuntime(identifier, tableRuntimeMeta, states);
if (!tableRuntime.isPresent()) {
Expand Down