[BugFix][Cherry-pick][Branch-3.0] Recalculate max_continuous_version after schema change finished (#28473) #28522
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We will create a new tablet for each original tablet and we will write original tablet and new tablet during schema change. We will construct a
version_graph
to keep versions info for each table and the following code is how to updateversion_graph
:There exists a scenario where _max_continuous_version cannot be updated correctly
e.g.
t2
for origin tablett1
during schema change andt2
has version 91,92,93,95,96,97,98. version 94 write failed.t1
has version [0-90], [91-96], 97, 98max_continuous_version
oft2
is 0 before convert rowset. After convert version [0-90],max_continuous_version
is update to 93 becauset2
has version 91-93 before.max_continuous_version
don't update because the left rowsets version is not satisfy update condition(version.fisrt == 0 or version.first == _max_continuous_verison + 1). So themax_continuous_version
will keep 93 after convert rowset finished.t2
at last and it should not less than alter version. But max_continuous_version(93) is less than alter version(98), so the alter job failed at last.The main reason is we don't update
_max_continuous_version
correctly during alter job, we should recalculate themax_continuous_version
after rowset conversion.