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

yiguolei 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 ffdd31e8831 branch-3.0: [regression-test](fix) fix backup and restore 
case #47058 (#47104)
ffdd31e8831 is described below

commit ffdd31e8831222cfdce8632c53eb79e963236d8d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jan 16 23:21:22 2025 +0800

    branch-3.0: [regression-test](fix) fix backup and restore case #47058 
(#47104)
    
    Cherry-picked from #47058
    
    Co-authored-by: yagagagaga <zhangmi...@selectdb.com>
---
 .../doc/admin-manual/data-admin/backup.md.groovy   | 36 +++++++++++-------
 .../doc/admin-manual/data-admin/restore.md.groovy  | 44 ++++++++++++----------
 2 files changed, 46 insertions(+), 34 deletions(-)

diff --git 
a/regression-test/suites/doc/admin-manual/data-admin/backup.md.groovy 
b/regression-test/suites/doc/admin-manual/data-admin/backup.md.groovy
index 4c7f6406a2a..131c64cbb48 100644
--- a/regression-test/suites/doc/admin-manual/data-admin/backup.md.groovy
+++ b/regression-test/suites/doc/admin-manual/data-admin/backup.md.groovy
@@ -17,13 +17,22 @@
 
 import org.junit.jupiter.api.Assertions;
 
-suite("docs/admin-manual/data-admin/backup.md", "p0,nonConcurrent") {
+suite("docs/admin-manual/data-admin/backup.md", "backup_restore") {
+    if (isCloudMode()) {
+        logger.info("skip this case, because not supported in cloud mode")
+        return
+    }
+    if (!enableHdfs()) {
+        logger.info("skip this case, because hdfs is not enable")
+        return
+    }
     try {
+        def uuid = UUID.randomUUID().hashCode().abs()
         multi_sql """
-            CREATE DATABASE IF NOT EXISTS example_db;
-            USE example_db;
+            CREATE DATABASE IF NOT EXISTS example_db${uuid};
+            USE example_db${uuid};
             DROP TABLE IF EXISTS example_tbl;
-            CREATE TABLE IF NOT EXISTS example_db.example_tbl(
+            CREATE TABLE IF NOT EXISTS example_db${uuid}.example_tbl(
                 a INT
             ) PARTITION BY RANGE(a) (
                 PARTITION p1 VALUES LESS THAN (1),
@@ -38,7 +47,6 @@ suite("docs/admin-manual/data-admin/backup.md", 
"p0,nonConcurrent") {
             INSERT INTO example_tbl2 SELECT * FROM example_tbl;
         """
 
-        def uuid = UUID.randomUUID().hashCode().abs()
         def syncer = getSyncer()
         /*
          CREATE REPOSITORY `example_repo`
@@ -50,7 +58,7 @@ suite("docs/admin-manual/data-admin/backup.md", 
"p0,nonConcurrent") {
          "hadoop.username" = "hadoop"
          );
          */
-        syncer.createHdfsRepository("example_repo")
+        syncer.createHdfsRepository("example_repo${uuid}")
 
         /*
         CREATE REPOSITORY `s3_repo`
@@ -64,28 +72,28 @@ suite("docs/admin-manual/data-admin/backup.md", 
"p0,nonConcurrent") {
             "AWS_REGION" = "xxx"
         );
          */
-        syncer.createS3Repository("s3_repo")
+        syncer.createS3Repository("s3_repo${uuid}")
         sql """
-            BACKUP SNAPSHOT example_db.snapshot_label1${uuid}
-            TO example_repo
+            BACKUP SNAPSHOT example_db${uuid}.snapshot_label1${uuid}
+            TO example_repo${uuid}
             ON (example_tbl)
             PROPERTIES ("type" = "full");
         """
-        syncer.waitSnapshotFinish("example_db")
+        syncer.waitSnapshotFinish("example_db${uuid}")
 
         sql """
-            BACKUP SNAPSHOT example_db.snapshot_label2${uuid}
-            TO example_repo
+            BACKUP SNAPSHOT example_db${uuid}.snapshot_label2${uuid}
+            TO example_repo${uuid}
             ON
             (
                example_tbl PARTITION (p1,p2),
                example_tbl2
             );
         """
-        syncer.waitSnapshotFinish("example_db")
+        syncer.waitSnapshotFinish("example_db${uuid}")
 
         sql """show BACKUP"""
-        sql """SHOW SNAPSHOT ON example_repo WHERE SNAPSHOT = 
"snapshot_label1${uuid}";"""
+        sql """SHOW SNAPSHOT ON example_repo${uuid} WHERE SNAPSHOT = 
"snapshot_label1${uuid}";"""
 
     } catch (Throwable t) {
         Assertions.fail("examples in docs/admin-manual/data-admin/backup.md 
failed to exec, please fix it", t)
diff --git 
a/regression-test/suites/doc/admin-manual/data-admin/restore.md.groovy 
b/regression-test/suites/doc/admin-manual/data-admin/restore.md.groovy
index f36d225854b..e0fb1d4ccfd 100644
--- a/regression-test/suites/doc/admin-manual/data-admin/restore.md.groovy
+++ b/regression-test/suites/doc/admin-manual/data-admin/restore.md.groovy
@@ -17,13 +17,18 @@
 
 import org.junit.jupiter.api.Assertions;
 
-suite("docs/admin-manual/data-admin/restore.md", "p0,nonConcurrent") {
+suite("docs/admin-manual/data-admin/restore.md") {
+    if (isCloudMode()) {
+        logger.info("skip this case, because not supported in cloud mode")
+        return
+    }
     try {
+        def uuid = UUID.randomUUID().hashCode().abs()
         multi_sql """
-            CREATE DATABASE IF NOT EXISTS example_db1;
-            USE example_db1;
+            CREATE DATABASE IF NOT EXISTS example_db${uuid};
+            USE example_db${uuid};
             DROP TABLE IF EXISTS backup_tbl;
-            CREATE TABLE IF NOT EXISTS example_db1.backup_tbl(
+            CREATE TABLE IF NOT EXISTS example_db${uuid}.backup_tbl(
                 a INT
             ) PARTITION BY RANGE(a) (
                 PARTITION p1 VALUES LESS THAN (1),
@@ -38,33 +43,32 @@ suite("docs/admin-manual/data-admin/restore.md", 
"p0,nonConcurrent") {
             INSERT INTO backup_tbl2 SELECT * FROM backup_tbl;
         """
 
-        def uuid = UUID.randomUUID().hashCode().abs()
         def syncer = getSyncer()
-        syncer.createS3Repository("example_repo")
+        syncer.createS3Repository("example_repo${uuid}")
         sql """
-            BACKUP SNAPSHOT example_db1.snapshot_1${uuid}
-            TO example_repo
+            BACKUP SNAPSHOT example_db${uuid}.snapshot_1${uuid}
+            TO example_repo${uuid}
             ON (backup_tbl)
             PROPERTIES ("type" = "full");
         """
-        syncer.waitSnapshotFinish("example_db1")
+        syncer.waitSnapshotFinish("example_db${uuid}")
         sql """
-            BACKUP SNAPSHOT example_db1.snapshot_2${uuid}
-            TO example_repo
+            BACKUP SNAPSHOT example_db${uuid}.snapshot_2${uuid}
+            TO example_repo${uuid}
             ON (backup_tbl, backup_tbl2)
             PROPERTIES ("type" = "full");
         """
-        syncer.waitSnapshotFinish("example_db1")
+        syncer.waitSnapshotFinish("example_db${uuid}")
 
         multi_sql """
             truncate table backup_tbl;
             truncate table backup_tbl2;
         """
 
-        var timestamp = syncer.getSnapshotTimestamp("example_repo", 
"snapshot_1${uuid}")
+        var timestamp = syncer.getSnapshotTimestamp("example_repo${uuid}", 
"snapshot_1${uuid}")
         sql """
-            RESTORE SNAPSHOT example_db1.`snapshot_1${uuid}`
-            FROM `example_repo`
+            RESTORE SNAPSHOT example_db${uuid}.`snapshot_1${uuid}`
+            FROM `example_repo${uuid}`
             ON ( `backup_tbl` )
             PROPERTIES
             (
@@ -72,12 +76,12 @@ suite("docs/admin-manual/data-admin/restore.md", 
"p0,nonConcurrent") {
                 "replication_num" = "1"
             );
         """
-        syncer.waitAllRestoreFinish("example_db1")
+        syncer.waitAllRestoreFinish("example_db${uuid}")
 
-        var timestamp2 = syncer.getSnapshotTimestamp("example_repo", 
"snapshot_2${uuid}")
+        var timestamp2 = syncer.getSnapshotTimestamp("example_repo${uuid}", 
"snapshot_2${uuid}")
         sql """
-            RESTORE SNAPSHOT example_db1.`snapshot_2${uuid}`
-            FROM `example_repo`
+            RESTORE SNAPSHOT example_db${uuid}.`snapshot_2${uuid}`
+            FROM `example_repo${uuid}`
             ON
             (
                 `backup_tbl` PARTITION (`p1`, `p2`),
@@ -89,7 +93,7 @@ suite("docs/admin-manual/data-admin/restore.md", 
"p0,nonConcurrent") {
                 "replication_num" = "1"
             );
         """
-        syncer.waitAllRestoreFinish("example_db1")
+        syncer.waitAllRestoreFinish("example_db${uuid}")
 
         sql """SHOW RESTORE"""
 


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

Reply via email to