This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 3a486df1791e287891a3af86ee71805a50c2f7c0 Author: walter <[email protected]> AuthorDate: Mon Apr 15 22:56:17 2024 +0800 [case](regression) Add backup temp partition case (#33646) --- .../backup_restore/test_backup_restore.groovy | 9 ++-- ...st_backup_restore_backup_temp_partition.groovy} | 58 ++++++++++------------ 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/regression-test/suites/backup_restore/test_backup_restore.groovy b/regression-test/suites/backup_restore/test_backup_restore.groovy index 03ec2de93b7..df1e9ff069d 100644 --- a/regression-test/suites/backup_restore/test_backup_restore.groovy +++ b/regression-test/suites/backup_restore/test_backup_restore.groovy @@ -16,9 +16,11 @@ // under the License. suite("test_backup_restore", "backup_restore") { - String repoName = "test_backup_restore_repo" - String dbName = "backup_restore_db" - String tableName = "test_backup_restore_table" + String suiteName = "test_backup_restore" + String repoName = "${suiteName}_repo" + String dbName = "${suiteName}_db" + String tableName = "${suiteName}_table" + String snapshotName = "${suiteName}_snapshot" def syncer = getSyncer() syncer.createS3Repository(repoName) @@ -45,7 +47,6 @@ suite("test_backup_restore", "backup_restore") { def result = sql "SELECT * FROM ${dbName}.${tableName}" assertEquals(result.size(), values.size()); - String snapshotName = "test_backup_restore_snapshot" sql """ BACKUP SNAPSHOT ${dbName}.${snapshotName} TO `${repoName}` diff --git a/regression-test/suites/backup_restore/test_backup_restore.groovy b/regression-test/suites/backup_restore/test_backup_restore_backup_temp_partition.groovy similarity index 62% copy from regression-test/suites/backup_restore/test_backup_restore.groovy copy to regression-test/suites/backup_restore/test_backup_restore_backup_temp_partition.groovy index 03ec2de93b7..40dbb44c56c 100644 --- a/regression-test/suites/backup_restore/test_backup_restore.groovy +++ b/regression-test/suites/backup_restore/test_backup_restore_backup_temp_partition.groovy @@ -15,10 +15,12 @@ // specific language governing permissions and limitations // under the License. -suite("test_backup_restore", "backup_restore") { - String repoName = "test_backup_restore_repo" - String dbName = "backup_restore_db" - String tableName = "test_backup_restore_table" +suite("test_backup_restore_backup_temp_partition", "backup_restore") { + String suiteName = "test_backup_restore_backup_temp_partition" + String repoName = "${suiteName}_repo" + String dbName = "${suiteName}_db" + String tableName = "${suiteName}_table" + String snapshotName = "${suiteName}_snapshot" def syncer = getSyncer() syncer.createS3Repository(repoName) @@ -30,6 +32,16 @@ suite("test_backup_restore", "backup_restore") { `id` LARGEINT NOT NULL, `count` LARGEINT SUM DEFAULT "0") AGGREGATE KEY(`id`) + PARTITION BY RANGE(`id`) + ( + PARTITION p1 VALUES LESS THAN ("10"), + PARTITION p2 VALUES LESS THAN ("20"), + PARTITION p3 VALUES LESS THAN ("30"), + PARTITION p4 VALUES LESS THAN ("40"), + PARTITION p5 VALUES LESS THAN ("50"), + PARTITION p6 VALUES LESS THAN ("60"), + PARTITION p7 VALUES LESS THAN MAXVALUE + ) DISTRIBUTED BY HASH(`id`) BUCKETS 2 PROPERTIES ( @@ -45,35 +57,19 @@ suite("test_backup_restore", "backup_restore") { def result = sql "SELECT * FROM ${dbName}.${tableName}" assertEquals(result.size(), values.size()); - String snapshotName = "test_backup_restore_snapshot" - sql """ - BACKUP SNAPSHOT ${dbName}.${snapshotName} - TO `${repoName}` - ON (${tableName}) - """ - - syncer.waitSnapshotFinish(dbName) - - def snapshot = syncer.getSnapshotTimestamp(repoName, snapshotName) - assertTrue(snapshot != null) - - sql "TRUNCATE TABLE ${dbName}.${tableName}" - + // add temp partitions sql """ - RESTORE SNAPSHOT ${dbName}.${snapshotName} - FROM `${repoName}` - ON ( `${tableName}`) - PROPERTIES - ( - "backup_timestamp" = "${snapshot}", - "reserve_replica" = "true" - ) - """ - - syncer.waitAllRestoreFinish(dbName) + ALTER TABLE ${dbName}.${tableName} ADD TEMPORARY PARTITION tp1 VALUES LESS THAN ("70") + """ - result = sql "SELECT * FROM ${dbName}.${tableName}" - assertEquals(result.size(), values.size()); + test { + sql """ + BACKUP SNAPSHOT ${dbName}.${snapshotName} + TO `${repoName}` + ON (${tableName}) + """ + exception "Do not support backup table with temp partitions" + } sql "DROP TABLE ${dbName}.${tableName} FORCE" sql "DROP DATABASE ${dbName} FORCE" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
