Skip to content

Commit

Permalink
Disable clean tables & partitions by default (#153)
Browse files Browse the repository at this point in the history
Since the clean tables will drop view unexpectedly
  • Loading branch information
w41ter authored Sep 9, 2024
1 parent e3c5bad commit 189e448
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/ccr/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ const (

var (
featureSchemaChangePartialSync bool
featureCleanTableAndPartitions bool
)

func init() {
flag.BoolVar(&featureSchemaChangePartialSync, "feature_schema_change_partial_sync", true,
"use partial sync when working with schema change")

// The default value is false, since clean tables will erase views unexpectedly.
flag.BoolVar(&featureCleanTableAndPartitions, "feature_clean_table_and_partitions", false,
"clean non restored tables and partitions during fullsync")
}

type SyncType int
Expand Down Expand Up @@ -671,6 +676,10 @@ func (j *Job) fullSync() error {
if j.SyncType == DBSync {
cleanTables = true
}
if featureCleanTableAndPartitions {
cleanTables = false
cleanPartitions = false
}
restoreResp, err := destRpc.RestoreSnapshot(dest, tableRefs, restoreSnapshotName, snapshotResp, cleanTables, cleanPartitions)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// under the License.

suite("test_db_sync_clean_restore") {
// FIXME(walter) fix clean tables.
return

def tableName = "tbl_db_sync_clean_restore_" + UUID.randomUUID().toString().replace("-", "")
def syncerAddress = "127.0.0.1:9190"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// under the License.

suite("test_restore_clean_partitions") {
// FIXME(walter) fix clean partitions.
return

def tableName = "tbl_clean_partitions_" + UUID.randomUUID().toString().replace("-", "")
def syncerAddress = "127.0.0.1:9190"
Expand Down

0 comments on commit 189e448

Please sign in to comment.