From ee1e939e25092fbba0f3cf52d7a12eeddefbab66 Mon Sep 17 00:00:00 2001 From: walter Date: Wed, 11 Sep 2024 11:04:27 +0800 Subject: [PATCH] [fix](restore) Persist the sqlMode field of the View (#40612) During initialization, the View will parse inlineViewRef again according to the sqlMode value. Therefore, sqlMode must be persisted. --- .../main/java/org/apache/doris/catalog/View.java | 1 + .../test_backup_restore_with_view.groovy | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java index 8285dedc0941b8..62402c7d474f3b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java @@ -76,6 +76,7 @@ public class View extends Table implements GsonPostProcessable { private String inlineViewDef; // for persist + @SerializedName("sm") private long sqlMode = 0L; // View definition created by parsing inlineViewDef_ into a QueryStmt. diff --git a/regression-test/suites/backup_restore/test_backup_restore_with_view.groovy b/regression-test/suites/backup_restore/test_backup_restore_with_view.groovy index eee4a70c745ed5..be7769953230db 100644 --- a/regression-test/suites/backup_restore/test_backup_restore_with_view.groovy +++ b/regression-test/suites/backup_restore/test_backup_restore_with_view.groovy @@ -92,6 +92,22 @@ suite("test_backup_restore_with_view", "backup_restore") { assertTrue(show_view.contains("${dbName1}")) assertTrue(show_view.contains("${tableName}")) + // restore to db, test the view signature. + sql """ + RESTORE SNAPSHOT ${dbName}.${snapshotName} + FROM `${repoName}` + PROPERTIES + ( + "backup_timestamp" = "${snapshot}", + "reserve_replica" = "true" + ) + """ + + syncer.waitAllRestoreFinish(dbName) + def restore_result = sql_return_maparray """ SHOW RESTORE FROM ${dbName} WHERE Label ="${snapshotName}" """ + restore_result.last() + logger.info("show restore result: ${restore_result}") + assertTrue(restore_result.last().State == "FINISHED") sql "DROP TABLE ${dbName}.${tableName} FORCE" sql "DROP VIEW ${dbName}.${viewName}"