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

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


The following commit(s) were added to refs/heads/master by this push:
     new e7803ce2147 [fix](regression) wait for version headroom before schema 
change (#65373)
e7803ce2147 is described below

commit e7803ce2147b12b7d0c82871f3e651f3b640c63b
Author: shuke <[email protected]>
AuthorDate: Wed Jul 15 20:58:06 2026 +0800

    [fix](regression) wait for version headroom before schema change (#65373)
    
    Related PR: #65233
    
    Problem Summary:
    
    `test_schema_change_with_empty_rowset` needs cumulative compaction to
    leave enough version headroom before starting schema change and 20
    additional inserts. Waiting on generic cumulative run/status metadata
    can return before that case-specific postcondition is true.
    
    Trigger cumulative compaction for every tablet, then poll `SHOW TABLETS`
    until every `VersionCount` is below the calculated safe threshold. This
    directly verifies the condition required by the remainder of the case
    and leaves the shared compaction helper and BE product code unchanged.
---
 .../test_schema_change_with_empty_rowset.groovy    | 44 ++++++++++++++++++++--
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git 
a/regression-test/suites/schema_change_p0/test_schema_change_with_empty_rowset.groovy
 
b/regression-test/suites/schema_change_p0/test_schema_change_with_empty_rowset.groovy
index 008b1033e9e..6a316b7e129 100644
--- 
a/regression-test/suites/schema_change_p0/test_schema_change_with_empty_rowset.groovy
+++ 
b/regression-test/suites/schema_change_p0/test_schema_change_with_empty_rowset.groovy
@@ -31,6 +31,42 @@ suite("test_schema_change_with_empty_rowset", 
"p0,nonConcurrent") {
         return jobStateResult[0][9]
     }
 
+    def backendIdToHost = [:]
+    def backendIdToHttpPort = [:]
+    getBackendIpHttpPort(backendIdToHost, backendIdToHttpPort)
+
+    def triggerCumulativeAndWaitForVersionCount = { tbl, int 
targetVersionCount ->
+        def tablets = sql_return_maparray """ SHOW TABLETS FROM ${tbl} """
+        for (def tablet in tablets) {
+            def host = backendIdToHost["${tablet.BackendId}"]
+            def port = backendIdToHttpPort["${tablet.BackendId}"]
+            def (code, out, err) = be_run_cumulative_compaction(host, port, 
tablet.TabletId)
+            assert code == 0: "trigger cumulative compaction failed, 
tablet=${tablet.TabletId}, " +
+                    "code=${code}, stdout=${out}, stderr=${err}"
+            def triggerStatus = parseJson(out.trim())
+            assert triggerStatus.status?.equalsIgnoreCase("Success"):
+                    "trigger cumulative compaction failed, 
tablet=${tablet.TabletId}, stdout=${out}"
+        }
+
+        // The rowsets returned by the BE are the active versions used by its 
load admission check.
+        Awaitility.await().atMost(300, TimeUnit.SECONDS).pollInterval(1, 
TimeUnit.SECONDS).until {
+            def versionCounts = [:]
+            for (def tablet in tablets) {
+                def host = backendIdToHost["${tablet.BackendId}"]
+                def port = backendIdToHttpPort["${tablet.BackendId}"]
+                def (code, out, err) = be_show_tablet_status(host, port, 
tablet.TabletId)
+                assert code == 0: "get compaction status failed, 
tablet=${tablet.TabletId}, " +
+                        "code=${code}, stdout=${out}, stderr=${err}"
+                def tabletStatus = parseJson(out.trim())
+                assert tabletStatus.rowsets instanceof List:
+                        "invalid compaction status, tablet=${tablet.TabletId}, 
stdout=${out}"
+                versionCounts[tablet.TabletId] = tabletStatus.rowsets.size()
+            }
+            logger.info("waiting for ${tbl} BE version count <= 
${targetVersionCount}, current=${versionCounts}")
+            return versionCounts.values().every { it <= targetVersionCount }
+        }
+    }
+
     sql """ DROP TABLE IF EXISTS ${tableName} """
 
     sql """
@@ -64,12 +100,14 @@ suite("test_schema_change_with_empty_rowset", 
"p0,nonConcurrent") {
     }   
 
 
-    // trigger compactions for all tablets in ${tableName}
-    trigger_and_wait_compaction(tableName, "cumulative")
+    // Leave enough version headroom for the schema change and the following 
inserts.
+    int insertCountAfterCompaction = 20
+    int targetVersionCount = custoBeConfig.max_tablet_version_num - 
insertCountAfterCompaction - 1
+    triggerCumulativeAndWaitForVersionCount(tableName, targetVersionCount)
 
     sql """ alter table ${tableName} modify column k4 string NULL"""
 
-    for (int i = 100; i < 120; i++) {
+    for (int i = 100; i < 100 + insertCountAfterCompaction; i++) {
         sql """ insert into ${tableName} values ($i, 2, 3, 4, 5, 6.6, 1.7, 8.8,
     'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
         sleep(20)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to