Skip to content
Open
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
2 changes: 1 addition & 1 deletion pkg/meta/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
19 changes: 19 additions & 0 deletions pkg/meta/model/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to introduce ActiveActiveInfo for further extension ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any other info to store like TTL? I did not see that in the spec..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If SoftdeleteInfo != nil can be used to replace IsActiveActive, is it possible to remove IsActiveActive?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soft delete and active-active are two standalone features. I think these flags should be separate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well. From this PR description, it's not clear that these are two separate functions. Moreover, there is no call to these variables in the implementation. So, I would like to ask about this.

// 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"`

Expand Down Expand Up @@ -1436,3 +1441,17 @@ func (t *TTLInfo) GetJobInterval() (time.Duration, error) {

return duration.ParseDuration(t.JobInterval)
}

// SoftdeleteInfo records the Softdelete config.
type SoftdeleteInfo struct {
Retention string `json:"retention"`
// JobEnable is used to control the cleanup JobEnable
JobEnable bool `json:"job_enable"`
JobInterval string `json:"job_interval"`
}

// Clone clones TTLInfo
func (t *SoftdeleteInfo) Clone() *SoftdeleteInfo {
cloned := *t
return &cloned
}