Skip to content

[AlterTable] Failed to alter table #5612

@acelyc111

Description

@acelyc111

Describe the bug
Add a column to a table, but the process blocked.
I found an exception on FE like:

2021-04-08 13:39:44,663 INFO (thrift-server-pool-613|804) [AlterHandler.handleFinishAlterTask():451] before handle alter task tablet 481265671, replica: [replicaId=481265672, BackendId=62134593, version=1, versionHash=0, dataSize=331285058, rowCount=1823157, lastFailedVersion=3, lastFailedVersionHash=6798223064512349591, lastSuccessVersion=27, lastSuccessVersionHash=5339720724553352740, lastFailedTimestamp=1617814890844, schemaHash=80261792, state=ALTER], task version: 3-6798223064512349591
2021-04-08 13:39:44,664 WARN (thrift-server-pool-613|804) [MasterImpl.finishTask():221] finish agent task error.
java.lang.IllegalStateException: 3
        at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[jprotobuf-2.2.11-jar-with-dependencies.jar:?]
        at org.apache.doris.alter.AlterHandler.handleFinishAlterTask(AlterHandler.java:463) ~[palo-fe.jar:3.4.0]
        at org.apache.doris.master.MasterImpl.finishAlterTask(MasterImpl.java:847) ~[palo-fe.jar:3.4.0]
        at org.apache.doris.master.MasterImpl.finishTask(MasterImpl.java:210) [palo-fe.jar:3.4.0]
        at org.apache.doris.service.FrontendServiceImpl.finishTask(FrontendServiceImpl.java:376) [palo-fe.jar:3.4.0]
        at org.apache.doris.thrift.FrontendService$Processor$finishTask.getResult(FrontendService.java:1473) [palo-fe.jar:3.4.0]
        at org.apache.doris.thrift.FrontendService$Processor$finishTask.getResult(FrontendService.java:1458) [palo-fe.jar:3.4.0]
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39) [libthrift-0.9.3.jar:0.9.3]
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) [libthrift-0.9.3.jar:0.9.3]
        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286) [libthrift-0.9.3.jar:0.9.3]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

The new tablet's info can not be updated, and the process blocked.

Why we need this check in case 1?

if (replica.getVersion() > task.getVersion()) {
                // Case 2.2, do nothing
            } else {
                if (replica.getLastFailedVersion() > task.getVersion()) {
                    // Case 2.1
                    replica.updateVersionInfo(task.getVersion(), task.getVersionHash(), replica.getDataSize(), replica.getRowCount());
                    versionChanged = true;
                } else {
                    // Case 1
                    Preconditions.checkState(replica.getLastFailedVersion() == -1, replica.getLastFailedVersion());  // Why we need this check?
                    replica.updateVersionInfo(task.getVersion(), task.getVersionHash(), replica.getDataSize(), replica.getRowCount());
                    versionChanged = true;
                }
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions