From 86fe2b90c0af05c898758df031d96be8df862bdf Mon Sep 17 00:00:00 2001 From: xhe Date: Mon, 17 Nov 2025 10:57:07 +0800 Subject: [PATCH 1/5] model: add minimal info for active-active table Signed-off-by: xhe --- pkg/meta/model/table.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/meta/model/table.go b/pkg/meta/model/table.go index 54fe9609574d6..d9bbb3e99de09 100644 --- a/pkg/meta/model/table.go +++ b/pkg/meta/model/table.go @@ -199,6 +199,11 @@ type TableInfo struct { TTLInfo *TTLInfo `json:"ttl_info"` + // IsActiveActive means the table is active-active table. + IsActiveActive bool `json:"is_active_active"` + // SoftdeleteInfo is softdelete TTL. It is required if IsActiveActive == true. + SoftdeleteInfo *SoftdeleteInfo `json:"softdelete_info"` + // Revision is per table schema's version, it will be increased when the schema changed. Revision uint64 `json:"revision"` @@ -1436,3 +1441,16 @@ func (t *TTLInfo) GetJobInterval() (time.Duration, error) { return duration.ParseDuration(t.JobInterval) } + +// SoftdeleteInfo records the Softdelete config. +type SoftdeleteInfo struct { + Enable bool `json:"enable"` + Retention string `json:"retention"` + JobInterval string `json:"job_interval"` +} + +// Clone clones TTLInfo +func (t *SoftdeleteInfo) Clone() *SoftdeleteInfo { + cloned := *t + return &cloned +} From 2002564ddfb45cb4e730eee1f1c6c90e3a10344e Mon Sep 17 00:00:00 2001 From: xhe Date: Mon, 17 Nov 2025 11:13:17 +0800 Subject: [PATCH 2/5] fix indent Signed-off-by: xhe --- pkg/meta/model/table.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/meta/model/table.go b/pkg/meta/model/table.go index d9bbb3e99de09..0b2fc46446859 100644 --- a/pkg/meta/model/table.go +++ b/pkg/meta/model/table.go @@ -1444,9 +1444,9 @@ func (t *TTLInfo) GetJobInterval() (time.Duration, error) { // SoftdeleteInfo records the Softdelete config. type SoftdeleteInfo struct { - Enable bool `json:"enable"` - Retention string `json:"retention"` - JobInterval string `json:"job_interval"` + Enable bool `json:"enable"` + Retention string `json:"retention"` + JobInterval string `json:"job_interval"` } // Clone clones TTLInfo From 2f1ac17e7ba3348da933b33e7303ea7cb61f0885 Mon Sep 17 00:00:00 2001 From: xhe Date: Mon, 17 Nov 2025 11:29:58 +0800 Subject: [PATCH 3/5] fix test Signed-off-by: xhe --- pkg/meta/meta_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/meta/meta_test.go b/pkg/meta/meta_test.go index c386ed82d1554..6958f2dcfb0f2 100644 --- a/pkg/meta/meta_test.go +++ b/pkg/meta/meta_test.go @@ -762,7 +762,7 @@ func TestIsTableInfoMustLoadSubStringsOrder(t *testing.T) { tableInfo := &model.TableInfo{} b, err := json.Marshal(tableInfo) require.NoError(t, err) - expect := `{"id":0,"name":{"O":"","L":""},"charset":"","collate":"","cols":null,"index_info":null,"constraint_info":null,"fk_info":null,"state":0,"pk_is_handle":false,"is_common_handle":false,"common_handle_version":0,"comment":"","auto_inc_id":0,"auto_id_cache":0,"auto_rand_id":0,"max_col_id":0,"max_idx_id":0,"max_fk_id":0,"max_cst_id":0,"update_timestamp":0,"ShardRowIDBits":0,"max_shard_row_id_bits":0,"auto_random_bits":0,"auto_random_range_bits":0,"pre_split_regions":0,"partition":null,"compression":"","view":null,"sequence":null,"Lock":null,"version":0,"tiflash_replica":null,"is_columnar":false,"temp_table_type":0,"cache_table_status":0,"policy_ref_info":null,"stats_options":null,"exchange_partition_info":null,"ttl_info":null,"revision":0}` + expect := `{\"id\":0,\"name\":{\"O\":\"\",\"L\":\"\"},\"charset\":\"\",\"collate\":\"\",\"cols\":null,\"index_info\":null,\"constraint_info\":null,\"fk_info\":null,\"state\":0,\"pk_is_handle\":false,\"is_common_handle\":false,\"common_handle_version\":0,\"comment\":\"\",\"auto_inc_id\":0,\"auto_id_cache\":0,\"auto_rand_id\":0,\"max_col_id\":0,\"max_idx_id\":0,\"max_fk_id\":0,\"max_cst_id\":0,\"update_timestamp\":0,\"ShardRowIDBits\":0,\"max_shard_row_id_bits\":0,\"auto_random_bits\":0,\"auto_random_range_bits\":0,\"pre_split_regions\":0,\"partition\":null,\"compression\":\"\",\"view\":null,\"sequence\":null,\"Lock\":null,\"version\":0,\"tiflash_replica\":null,\"is_columnar\":false,\"temp_table_type\":0,\"cache_table_status\":0,\"policy_ref_info\":null,\"stats_options\":null,\"exchange_partition_info\":null,\"ttl_info\":null,\"is_active_active\":false,\"softdelete_info\":null,\"revision\":0}` require.Equal(t, expect, string(b)) } From 3f79373a532cbcb1d948f3796c3128faf5d4214b Mon Sep 17 00:00:00 2001 From: xhe Date: Mon, 17 Nov 2025 11:56:32 +0800 Subject: [PATCH 4/5] fix test Signed-off-by: xhe --- pkg/meta/meta_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/meta/meta_test.go b/pkg/meta/meta_test.go index 6958f2dcfb0f2..af5fd34a63dcc 100644 --- a/pkg/meta/meta_test.go +++ b/pkg/meta/meta_test.go @@ -762,7 +762,7 @@ func TestIsTableInfoMustLoadSubStringsOrder(t *testing.T) { tableInfo := &model.TableInfo{} b, err := json.Marshal(tableInfo) require.NoError(t, err) - expect := `{\"id\":0,\"name\":{\"O\":\"\",\"L\":\"\"},\"charset\":\"\",\"collate\":\"\",\"cols\":null,\"index_info\":null,\"constraint_info\":null,\"fk_info\":null,\"state\":0,\"pk_is_handle\":false,\"is_common_handle\":false,\"common_handle_version\":0,\"comment\":\"\",\"auto_inc_id\":0,\"auto_id_cache\":0,\"auto_rand_id\":0,\"max_col_id\":0,\"max_idx_id\":0,\"max_fk_id\":0,\"max_cst_id\":0,\"update_timestamp\":0,\"ShardRowIDBits\":0,\"max_shard_row_id_bits\":0,\"auto_random_bits\":0,\"auto_random_range_bits\":0,\"pre_split_regions\":0,\"partition\":null,\"compression\":\"\",\"view\":null,\"sequence\":null,\"Lock\":null,\"version\":0,\"tiflash_replica\":null,\"is_columnar\":false,\"temp_table_type\":0,\"cache_table_status\":0,\"policy_ref_info\":null,\"stats_options\":null,\"exchange_partition_info\":null,\"ttl_info\":null,\"is_active_active\":false,\"softdelete_info\":null,\"revision\":0}` + expect := `{"id":0,"name":{"O":"","L":""},"charset":"","collate":"","cols":null,"index_info":null,"constraint_info":null,"fk_info":null,"state":0,"pk_is_handle":false,"is_common_handle":false,"common_handle_version":0,"comment":"","auto_inc_id":0,"auto_id_cache":0,"auto_rand_id":0,"max_col_id":0,"max_idx_id":0,"max_fk_id":0,"max_cst_id":0,"update_timestamp":0,"ShardRowIDBits":0,"max_shard_row_id_bits":0,"auto_random_bits":0,"auto_random_range_bits":0,"pre_split_regions":0,"partition":null,"compression":"","view":null,"sequence":null,"Lock":null,"version":0,"tiflash_replica":null,"is_columnar":false,"temp_table_type":0,"cache_table_status":0,"policy_ref_info":null,"stats_options":null,"exchange_partition_info":null,"ttl_info":null,"is_active_active":false,"softdelete_info":null,"revision":0}` require.Equal(t, expect, string(b)) } From 5eb0ad7c8d53f4d895221a35dce68ee8e74ccc09 Mon Sep 17 00:00:00 2001 From: xhe Date: Tue, 18 Nov 2025 11:30:38 +0800 Subject: [PATCH 5/5] add comment Signed-off-by: xhe --- pkg/meta/model/table.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/meta/model/table.go b/pkg/meta/model/table.go index 0b2fc46446859..d538c3aaad62c 100644 --- a/pkg/meta/model/table.go +++ b/pkg/meta/model/table.go @@ -1444,8 +1444,9 @@ func (t *TTLInfo) GetJobInterval() (time.Duration, error) { // SoftdeleteInfo records the Softdelete config. type SoftdeleteInfo struct { - Enable bool `json:"enable"` Retention string `json:"retention"` + // JobEnable is used to control the cleanup JobEnable + JobEnable bool `json:"job_enable"` JobInterval string `json:"job_interval"` }