Skip to content

Commit

Permalink
[fix](restore) Persist the sqlMode field of the View (#40612)
Browse files Browse the repository at this point in the history
During initialization, the View will parse inlineViewRef again according
to the sqlMode value. Therefore, sqlMode must be persisted.
  • Loading branch information
w41ter authored Sep 11, 2024
1 parent a01c85e commit ee1e939
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit ee1e939

Please sign in to comment.