Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix backup failure due to case-sensitive table name conflict #13

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Void visitBackupStatement(BackupStmt backupStmt, ConnectContext context)
String dbName = getDbName(backupStmt.getDbName(), context);
Database database = getDatabase(dbName, context);
analyzeLabelAndRepo(backupStmt.getLabel(), backupStmt.getRepoName());
Map<String, TableRef> tblPartsMap = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
Map<String, TableRef> tblPartsMap = Maps.newTreeMap();
List<TableRef> tableRefs = backupStmt.getTableRefs();
// If TableRefs is empty, it means that we do not specify any table in Backup stmt.
// We should backup all table in current database.
Expand Down Expand Up @@ -253,7 +253,7 @@ public Void visitShowBackupStatement(ShowBackupStmt showBackupStmt, ConnectConte
public Void visitRestoreStatement(RestoreStmt restoreStmt, ConnectContext context) {
List<TableRef> tableRefs = restoreStmt.getTableRefs();
Set<String> aliasSet = Sets.newHashSet();
Map<String, TableRef> tblPartsMap = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
Map<String, TableRef> tblPartsMap = Maps.newTreeMap();
for (TableRef tableRef : tableRefs) {
TableName tableName = tableRef.getName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public void testBackup() {
"PROPERTIES (\"type\" = \"full\",\"timeout\" = \"3600\");");
analyzeSuccess("BACKUP SNAPSHOT snapshot_pk_label TO `repo` ON ( tprimary ) " +
"PROPERTIES (\"type\" = \"full\",\"timeout\" = \"3600\");");
analyzeSuccess("BACKUP SNAPSHOT test.snapshot_label2 TO `repo` ON ( t3, T3 ) " +
"PROPERTIES (\"type\" = \"full\",\"timeout\" = \"3600\");");
analyzeFail("BACKUP SNAPSHOT test.snapshot_label2 TO `repo` ON ( t0, t0 ) " +
"PROPERTIES (\"type\" = \"full\",\"timeout\" = \"3600\");");
analyzeFail("BACKUP SNAPSHOT test.snapshot_label2 TO `repo` ON ( t0, t1 ) " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ public static void init() throws Exception {
"\"in_memory\" = \"false\"\n" +
");");

starRocksAssert.withTable("CREATE TABLE `t3` (\n" +
" `v10` bigint NULL COMMENT \"\",\n" +
" `v11` bigint NULL COMMENT \"\",\n" +
" `v12` bigint NULL\n" +
") ENGINE=OLAP\n" +
"DUPLICATE KEY(`v10`, `v11`, v12)\n" +
"DISTRIBUTED BY HASH(`v10`) BUCKETS 3\n" +
"PROPERTIES (\n" +
"\"replication_num\" = \"1\",\n" +
"\"in_memory\" = \"false\"\n" +
");");

starRocksAssert.withTable("CREATE TABLE `T3` (\n" +
" `v10` bigint NULL COMMENT \"\",\n" +
" `v11` bigint NULL COMMENT \"\",\n" +
" `v12` bigint NULL\n" +
") ENGINE=OLAP\n" +
"DUPLICATE KEY(`v10`, `v11`, v12)\n" +
"DISTRIBUTED BY HASH(`v10`) BUCKETS 3\n" +
"PROPERTIES (\n" +
"\"replication_num\" = \"1\",\n" +
"\"in_memory\" = \"false\"\n" +
");");

starRocksAssert.withTable("CREATE TABLE `tall` (\n" +
" `ta` varchar(20) NULL COMMENT \"\",\n" +
" `tb` smallint(6) NULL COMMENT \"\",\n" +
Expand Down
Loading