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

gavinchou pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 71a3cc7bb43 [chore](conf) Set enable_advance_next_id=true by default 
(#44790) (#46425)
71a3cc7bb43 is described below

commit 71a3cc7bb439e24a880eb59f887027c2de6301b5
Author: Gavin Chou <ga...@selectdb.com>
AuthorDate: Sun Jan 5 14:08:02 2025 +0800

    [chore](conf) Set enable_advance_next_id=true by default (#44790) (#46425)
    
    pick #44790
    
    Bind the generation of next_id to physical time to ensure its generation
    is monotonically increasing, even if we directly overwrite the FE
    metadata and then restart. This way, it supports a lossy cluster
    rollback in scenarios where major version upgrades are incompatible.
---
 fe/fe-common/src/main/java/org/apache/doris/common/Config.java    | 2 +-
 .../org/apache/doris/analysis/ExportToOutfileLogicalPlanTest.java | 8 ++++++++
 .../java/org/apache/doris/common/proc/IndexesProcNodeTest.java    | 2 +-
 .../java/org/apache/doris/service/FrontendServiceImplTest.java    | 5 ++++-
 .../src/test/java/org/apache/doris/utframe/TestWithFeService.java | 4 ++++
 5 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java 
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index a9a86601002..4dc2ede7297 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -2872,7 +2872,7 @@ public class Config extends ConfigBase {
             "Whether to advance the ID generator after becoming Master to 
ensure that the id "
                     + "generator will not be rolled back even when metadata is 
rolled back."
     })
-    public static boolean enable_advance_next_id = false;
+    public static boolean enable_advance_next_id = true;
 
     // The count threshold to do manual GC when doing checkpoint but not 
enough memory.
     // Set zero to disable it.
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/ExportToOutfileLogicalPlanTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/ExportToOutfileLogicalPlanTest.java
index 43256a14a13..096868276fd 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/ExportToOutfileLogicalPlanTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/ExportToOutfileLogicalPlanTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.doris.analysis;
 
+import org.apache.doris.common.Config;
 import org.apache.doris.common.FeConstants;
 import org.apache.doris.common.UserException;
 import org.apache.doris.load.ExportJob;
@@ -47,6 +48,12 @@ public class ExportToOutfileLogicalPlanTest extends 
TestWithFeService {
     private String dbName = "testDb";
     private String tblName = "table1";
 
+    private final boolean defaultEnableAdvanceNextId = 
Config.enable_advance_next_id; // backup
+
+    {
+        enableAdvanceNextId = false;
+    }
+
     /**
      * create a database and a table
      *
@@ -65,6 +72,7 @@ public class ExportToOutfileLogicalPlanTest extends 
TestWithFeService {
                 + "PARTITION p4 VALUES LESS THAN (\"50\")\n" + ")\n"
                 + " distributed by hash(k1) buckets 10\n"
                 + "properties(\"replication_num\" = \"1\");");
+        Config.enable_advance_next_id = defaultEnableAdvanceNextId; // restore
     }
 
     /**
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
index 966f6c38b5b..273915a2d20 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
@@ -96,7 +96,7 @@ public class IndexesProcNodeTest {
         Assert.assertEquals(procResult.getRows().get(3).get(5), "col_4");
         Assert.assertEquals(procResult.getRows().get(3).get(11), "NGRAM_BF");
         Assert.assertEquals(procResult.getRows().get(3).get(12), "ngram_bf 
index on col_4");
-        Assert.assertEquals(procResult.getRows().get(3).get(13), 
"(\"gram_size\" = \"3\", \"bf_size\" = \"256\")");
+        Assert.assertEquals(procResult.getRows().get(3).get(13), "(\"bf_size\" 
= \"256\", \"gram_size\" = \"3\")");
 
     }
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
index 2e5a4e07456..36a7447e2e4 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/service/FrontendServiceImplTest.java
@@ -185,7 +185,10 @@ public class FrontendServiceImplTest {
         TGetDbsResult dbNames = impl.getDbNames(params);
 
         Assert.assertEquals(dbNames.getDbs().size(), 2);
-        Assert.assertEquals(dbNames.getDbs(), Arrays.asList("test", "test_"));
+        List<String> expected = Arrays.asList("test", "test_");
+        dbNames.getDbs().sort(String::compareTo);
+        expected.sort(String::compareTo);
+        Assert.assertEquals(dbNames.getDbs(), expected);
     }
 
     @Test
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java 
b/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
index 8e25efdfada..ea8456179dc 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
@@ -140,6 +140,8 @@ public abstract class TestWithFeService {
     protected ConnectContext connectContext;
     protected boolean needCleanDir = true;
     protected int lastFeRpcPort = 0;
+    // make it default to enable_advance_next_id
+    protected boolean enableAdvanceNextId = Config.enable_advance_next_id;
 
     protected static final String DEFAULT_CLUSTER_PREFIX = "";
 
@@ -152,6 +154,8 @@ public abstract class TestWithFeService {
 
     @BeforeAll
     public final void beforeAll() throws Exception {
+        // this.enableAdvanceNextId may be reset by children classes
+        Config.enable_advance_next_id = this.enableAdvanceNextId;
         FeConstants.enableInternalSchemaDb = false;
         beforeCreatingConnectContext();
         connectContext = createDefaultCtx();


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

Reply via email to