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

zhangchen 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 68b13ab50f [Fix](Full compaction) Fix full compaction by table id case 
(#24265)
68b13ab50f is described below

commit 68b13ab50f65901b160ebaf1234c033cb605ba69
Author: abmdocrt <yukang.lian2...@gmail.com>
AuthorDate: Thu Sep 14 18:03:28 2023 +0800

    [Fix](Full compaction) Fix full compaction by table id case (#24265)
---
 .../test_full_compaction_by_table_id.groovy        | 94 ++++++++++++----------
 1 file changed, 50 insertions(+), 44 deletions(-)

diff --git 
a/regression-test/suites/compaction/test_full_compaction_by_table_id.groovy 
b/regression-test/suites/compaction/test_full_compaction_by_table_id.groovy
index 204a38e9f9..dc3c47c5a3 100644
--- a/regression-test/suites/compaction/test_full_compaction_by_table_id.groovy
+++ b/regression-test/suites/compaction/test_full_compaction_by_table_id.groovy
@@ -27,18 +27,20 @@ suite("test_full_compaction_by_table_id") {
         def backendId_to_backendHttpPort = [:]
         getBackendIpHttpPort(backendId_to_backendIP, 
backendId_to_backendHttpPort);
 
-        backend_id = backendId_to_backendIP.keySet()[0]
-        def (code, out, err) = 
show_be_config(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id))
-        logger.info("Show config: code=" + code + ", out=" + out + ", err=" + 
err)
-        assertEquals(code, 0)
-        def configList = parseJson(out.trim())
-        assert configList instanceof List
-
         boolean disableAutoCompaction = true
-        for (Object ele in (List) configList) {
-            assert ele instanceof List<String>
-            if (((List<String>) ele)[0] == "disable_auto_compaction") {
-                disableAutoCompaction = Boolean.parseBoolean(((List<String>) 
ele)[2])
+        for(int i=0;i<backendId_to_backendIP.keySet().size();i++){
+            backend_id = backendId_to_backendIP.keySet()[i]
+            def (code, out, err) = 
show_be_config(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id))
+            logger.info("Show config: code=" + code + ", out=" + out + ", 
err=" + err)
+            assertEquals(code, 0)
+            def configList = parseJson(out.trim())
+            assert configList instanceof List
+
+            for (Object ele in (List) configList) {
+                assert ele instanceof List<String>
+                if (((List<String>) ele)[0] == "disable_auto_compaction") {
+                    disableAutoCompaction = 
Boolean.parseBoolean(((List<String>) ele)[2])
+                }
             }
         }
 
@@ -114,43 +116,47 @@ suite("test_full_compaction_by_table_id") {
 
         // trigger full compactions for all tablets by table id in ${tableName}
         // TODO: get table id
-        String tablet_id = tablets[0][0]
-        String[][] tablet_info = sql """ show tablet ${tablet_id}; """
-        logger.info("tablet"+tablet_info)
-        table_id = tablet_info[0][5]
-        backend_id = tablets[0][2]
-        times = 1
-
-        do{
-            (code, out, err) = 
be_run_full_compaction_by_table_id(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id), table_id)
-            logger.info("Run compaction: code=" + code + ", out=" + out + ", 
err=" + err)
-            ++times
-            sleep(2000)
-        } while (parseJson(out.trim()).status.toLowerCase()!="success" && 
times<=10)
-
-        def compactJson = parseJson(out.trim())
-        if (compactJson.status.toLowerCase() == "fail") {
-            assertEquals(disableAutoCompaction, false)
-            logger.info("Compaction was done automatically!")
-        }
-        if (disableAutoCompaction) {
-            assertEquals("success", compactJson.status.toLowerCase())
+        for (int i=0; i<tablets.size(); ++i) {
+            String tablet_id = tablets[i][0]
+            String[][] tablet_info = sql """ show tablet ${tablet_id}; """
+            logger.info("tablet"+tablet_info)
+            table_id = tablet_info[0][5]
+            backend_id = tablets[i][2]
+            times = 1
+
+            do{
+                (code, out, err) = 
be_run_full_compaction_by_table_id(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id), table_id)
+                logger.info("Run compaction: code=" + code + ", out=" + out + 
", err=" + err)
+                ++times
+                sleep(2000)
+            } while (parseJson(out.trim()).status.toLowerCase()!="success" && 
times<=10)
+
+            def compactJson = parseJson(out.trim())
+            if (compactJson.status.toLowerCase() == "fail") {
+                assertEquals(disableAutoCompaction, false)
+                logger.info("Compaction was done automatically!")
+            }
+            if (disableAutoCompaction) {
+                assertEquals("success", compactJson.status.toLowerCase())
+            }
         }
 
         // wait for full compaction done
         {
-            boolean running = true
-            do {
-                Thread.sleep(1000)
-                tablet_id = tablets[0][0]
-                backend_id = tablets[0][2]
-                (code, out, err) = 
be_get_compaction_status(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id), tablet_id)
-                logger.info("Get compaction status: code=" + code + ", out=" + 
out + ", err=" + err)
-                assertEquals(code, 0)
-                def compactionStatus = parseJson(out.trim())
-                assertEquals("success", compactionStatus.status.toLowerCase())
-                running = compactionStatus.run_status
-            } while (running)
+            for (int i=0; i<tablets.size(); ++i) {
+                boolean running = true
+                do {
+                    Thread.sleep(1000)
+                    tablet_id = tablets[i][0]
+                    backend_id = tablets[i][2]
+                    (code, out, err) = 
be_get_compaction_status(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id), tablet_id)
+                    logger.info("Get compaction status: code=" + code + ", 
out=" + out + ", err=" + err)
+                    assertEquals(code, 0)
+                    def compactionStatus = parseJson(out.trim())
+                    assertEquals("success", 
compactionStatus.status.toLowerCase())
+                    running = compactionStatus.run_status
+                } while (running)
+            }
         }
 
         // after full compaction, there is only 1 rowset.


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

Reply via email to