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

[BugFix] fix schema change hang when data loading concurrent with schema change (backport #23456) #23660

Merged
merged 1 commit into from
May 22, 2023
Merged
Changes from all commits
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
19 changes: 7 additions & 12 deletions fe/fe-core/src/main/java/com/starrocks/task/AlterReplicaTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ public TAlterTabletReqV2 toThrift() {
* There are new load jobs after alter task, and at least one of them is succeed on this replica.
* So the replica's version should be larger than X. So we don't need to modify the replica version
* because its already looks like normal.
* Case 3:
* There are new load jobs after alter task, and their version and LFV is smaller or equal to X.
* And because alter request report success, it means that we can increase replica's version to X.
*/
public void handleFinishAlterTask() throws Exception {
Database db = GlobalStateMgr.getCurrentState().getDb(getDbId());
Expand Down Expand Up @@ -221,18 +224,10 @@ public void handleFinishAlterTask() throws Exception {
getVersion());
boolean versionChanged = false;
if (replica.getVersion() <= getVersion()) {
if (replica.getLastFailedVersion() > getVersion()) {
// Case 2.1
replica.updateRowCount(getVersion(), replica.getDataSize(),
replica.getRowCount());
versionChanged = true;
} else {
// Case 1
Preconditions.checkState(replica.getLastFailedVersion() == -1, replica.getLastFailedVersion());
replica.updateRowCount(getVersion(), replica.getDataSize(),
replica.getRowCount());
versionChanged = true;
}
// Case 1, Case 2.1 or Case 3
replica.updateRowCount(getVersion(), replica.getDataSize(),
replica.getRowCount());
versionChanged = true;
}

if (versionChanged) {
Expand Down