This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 11b4370  [Alter] Fix pending AlterJobV2 replay bug (#2922)
11b4370 is described below

commit 11b43700b95b07dac6c2d82e53beca0711cb22a6
Author: wangbo <506340...@qq.com>
AuthorDate: Mon Feb 17 23:02:18 2020 +0800

    [Alter] Fix pending AlterJobV2 replay bug (#2922)
    
    Call replayPending method when load pending status AlterJobV2.
    So that the tablet and replica won't missing in TabletInvertedIndex.
---
 fe/src/main/java/org/apache/doris/alter/RollupJobV2.java |  8 --------
 fe/src/main/java/org/apache/doris/catalog/Catalog.java   | 15 +++++++++++++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fe/src/main/java/org/apache/doris/alter/RollupJobV2.java 
b/fe/src/main/java/org/apache/doris/alter/RollupJobV2.java
index d7ea4e2..4f5b792 100644
--- a/fe/src/main/java/org/apache/doris/alter/RollupJobV2.java
+++ b/fe/src/main/java/org/apache/doris/alter/RollupJobV2.java
@@ -306,14 +306,6 @@ public class RollupJobV2 extends AlterJobV2 {
             throw new AlterCancelException("Databasee " + dbId + " does not 
exist");
         }
 
-        // TODO(wangbo): 2020/2/4
-        //   In the case that the [WaitingTxnJob|PendingJob] is checkpointed 
and replayMethod won't be called
-        //   For example,
-        //          1. create and pending job A
-        //          2. restart fe twice before job A running(for checkpoint 
job A)
-        //          3. For job A,replayPendingJob method won't be called,so we 
lose metadata in memory
-        //   So Make sure the tablet meta exists in olapTable and 
TabletInvertedIndex before doris run
-
         db.readLock();
         try {
             OlapTable tbl = (OlapTable) db.getTable(tableId);
diff --git a/fe/src/main/java/org/apache/doris/catalog/Catalog.java 
b/fe/src/main/java/org/apache/doris/catalog/Catalog.java
index 0c73b10..656f6a8 100644
--- a/fe/src/main/java/org/apache/doris/catalog/Catalog.java
+++ b/fe/src/main/java/org/apache/doris/catalog/Catalog.java
@@ -1702,8 +1702,19 @@ public class Catalog {
             newChecksum ^= size;
             for (int i = 0; i < size; i++) {
                 AlterJobV2 alterJobV2 = AlterJobV2.read(dis);
-                if (type == JobType.ROLLUP) {
-                    this.getRollupHandler().addAlterJobV2(alterJobV2);
+                if (type == JobType.ROLLUP || type == JobType.SCHEMA_CHANGE) {
+                    if (type == JobType.ROLLUP) {
+                        this.getRollupHandler().addAlterJobV2(alterJobV2);
+                    } else {
+                        alterJobsV2.put(alterJobV2.getJobId(), alterJobV2);
+                    }
+                    // ATTN : we just want to add tablet into 
TabletInvertedIndex when only PendingJob is checkpointed
+                    // to prevent TabletInvertedIndex data loss,
+                    // So just use AlterJob.replay() instead of 
AlterHandler.replay().
+                    if (alterJobV2.getJobState() == 
AlterJobV2.JobState.PENDING) {
+                        alterJobV2.replay(alterJobV2);
+                        LOG.info("replay pending alter job when load alter job 
{} ", alterJobV2.getJobId());
+                    }
                 } else {
                     alterJobsV2.put(alterJobV2.getJobId(), alterJobV2);
                 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to