Skip to content

Commit

Permalink
branch-3.0: [fix](build index)Fix non-master nodes cannot see the lat…
Browse files Browse the repository at this point in the history
…est build index job status apache#44544 (apache#44629)

Cherry-picked from apache#44544

Co-authored-by: qiye <[email protected]>
  • Loading branch information
github-actions[bot] and qidaye authored Nov 27, 2024
1 parent 6eb6a08 commit eea11ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ protected void runWaitingTxnJob() throws AlterCancelException {
olapTable.readUnlock();
}
this.jobState = JobState.RUNNING;
// DO NOT write edit log here, tasks will be sent again if FE restart or master changed.
LOG.info("transfer inverted index job {} state to {}", jobId, this.jobState);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ protected void runWaitingTxnJob() throws AlterCancelException {

this.jobState = JobState.RUNNING;

// DO NOT write edit log here, tasks will be send again if FE restart or master changed.
// DO NOT write edit log here, tasks will be sent again if FE restart or master changed.
LOG.info("transfer schema change job {} state to {}", jobId, this.jobState);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.doris.common.proc.ProcNodeInterface;
import org.apache.doris.common.proc.ProcService;
import org.apache.doris.common.util.OrderByPair;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.ShowResultSetMetaData;

import com.google.common.base.Strings;
Expand Down Expand Up @@ -224,4 +225,13 @@ public ShowResultSetMetaData getMetaData() {

return builder.build();
}

@Override
public RedirectStatus getRedirectStatus() {
if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
return RedirectStatus.FORWARD_NO_SYNC;
} else {
return RedirectStatus.NO_FORWARD;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ suite("test_build_index_with_clone_fault_injection", "nonConcurrent"){
while (attempt < maxRetries) {
def show_build_index = sql_return_maparray("show build index where TableName = \"${tbl}\" ORDER BY JobId DESC LIMIT 1")
if (show_build_index && show_build_index.size() > 0) {
logger.info("show build index result: ${show_build_index}")
def currentState = show_build_index[0].State
def currentMsg = show_build_index[0].Msg
if ((currentState == expectedState && currentMsg == expectedMsg) || currentState == "FINISHED") {
Expand Down

0 comments on commit eea11ed

Please sign in to comment.