Skip to content

Commit ab97450

Browse files
committed
chore: rename default_cluster_key_id to cluster_key_seq
1 parent f1c95cc commit ab97450

23 files changed

+33
-30
lines changed

src/meta/app/src/schema/table.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ pub struct TableMeta {
262262
pub options: BTreeMap<String, String>,
263263
// The default cluster key.
264264
pub default_cluster_key: Option<String>,
265-
// The sequence number of default_cluster_key.
266-
pub default_cluster_key_id: u32,
265+
/// A sequential number that uniquely identifies changes to the cluster key.
266+
/// This value increments by 1 each time the cluster key is created or modified,
267+
/// ensuring a unique identifier for each version of the cluster key.
268+
/// It remains unchanged when the cluster key is dropped.
269+
pub cluster_key_seq: u32,
267270
pub created_on: DateTime<Utc>,
268271
pub updated_on: DateTime<Utc>,
269272
pub comment: String,
@@ -410,7 +413,7 @@ impl TableInfo {
410413
self.meta
411414
.default_cluster_key
412415
.clone()
413-
.map(|k| (self.meta.default_cluster_key_id, k))
416+
.map(|k| (self.meta.cluster_key_seq, k))
414417
}
415418
}
416419

@@ -424,7 +427,7 @@ impl Default for TableMeta {
424427
part_prefix: "".to_string(),
425428
options: BTreeMap::new(),
426429
default_cluster_key: None,
427-
default_cluster_key_id: 0,
430+
cluster_key_seq: 0,
428431
created_on: Utc::now(),
429432
updated_on: Utc::now(),
430433
comment: "".to_string(),

src/meta/proto-conv/src/table_from_to_protobuf_impl.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ impl FromToProto for mt::TableMeta {
192192
indexes.insert(name, mt::TableIndex::from_pb(index)?);
193193
}
194194

195-
let default_cluster_key_id = if let Some(cluster_key_id) = p.default_cluster_key_id {
196-
cluster_key_id
195+
let cluster_key_seq = if let Some(seq) = p.cluster_key_seq {
196+
seq
197197
} else if p.cluster_keys.is_empty() {
198198
0
199199
} else {
@@ -211,7 +211,7 @@ impl FromToProto for mt::TableMeta {
211211
part_prefix: p.part_prefix.unwrap_or("".to_string()),
212212
options: p.options,
213213
default_cluster_key: p.default_cluster_key,
214-
default_cluster_key_id,
214+
cluster_key_seq,
215215
created_on: DateTime::<Utc>::from_pb(p.created_on)?,
216216
updated_on: DateTime::<Utc>::from_pb(p.updated_on)?,
217217
drop_on: match p.drop_on {
@@ -260,7 +260,7 @@ impl FromToProto for mt::TableMeta {
260260
default_cluster_key: self.default_cluster_key.clone(),
261261
// cluster_keys is deprecated.
262262
cluster_keys: vec![],
263-
default_cluster_key_id: Some(self.default_cluster_key_id),
263+
cluster_key_seq: Some(self.cluster_key_seq),
264264
created_on: self.created_on.to_pb()?,
265265
updated_on: self.updated_on.to_pb()?,
266266
drop_on: match self.drop_on {

src/meta/proto-conv/tests/it/proto_conv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn new_table_meta() -> mt::TableMeta {
141141
engine_options: btreemap! {s("abc") => s("def")},
142142
options: btreemap! {s("xyz") => s("foo")},
143143
default_cluster_key: Some("(a + 2, b)".to_string()),
144-
default_cluster_key_id: 0,
144+
cluster_key_seq: 0,
145145
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
146146
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
147147
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v002_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn test_decode_v2_table_meta() -> anyhow::Result<()> {
132132
engine_options: btreemap! {s("abc") => s("def")},
133133
options: btreemap! {s("xyz") => s("foo")},
134134
default_cluster_key: Some("(a + 2, b)".to_string()),
135-
default_cluster_key_id: 0,
135+
cluster_key_seq: 0,
136136
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
137137
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
138138
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v010_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn test_decode_v10_table_meta() -> anyhow::Result<()> {
134134
part_prefix: "".to_string(),
135135
options: btreemap! {s("xyz") => s("foo")},
136136
default_cluster_key: Some("(a + 2, b)".to_string()),
137-
default_cluster_key_id: 0,
137+
cluster_key_seq: 0,
138138
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
139139
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
140140
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v012_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn test_decode_v12_table_meta() -> anyhow::Result<()> {
136136
part_prefix: "".to_string(),
137137
options: btreemap! {s("xyz") => s("foo")},
138138
default_cluster_key: Some("(a + 2, b)".to_string()),
139-
default_cluster_key_id: 0,
139+
cluster_key_seq: 0,
140140
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
141141
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
142142
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v023_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn test_decode_v23_table_meta() -> anyhow::Result<()> {
136136
part_prefix: "lulu_".to_string(),
137137
options: btreemap! {s("xyz") => s("foo")},
138138
default_cluster_key: Some("(a + 2, b)".to_string()),
139-
default_cluster_key_id: 0,
139+
cluster_key_seq: 0,
140140
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
141141
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
142142
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v024_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn test_decode_v24_table_meta() -> anyhow::Result<()> {
136136
part_prefix: "lulu_".to_string(),
137137
options: btreemap! {s("xyz") => s("foo")},
138138
default_cluster_key: Some("(a + 2, b)".to_string()),
139-
default_cluster_key_id: 0,
139+
cluster_key_seq: 0,
140140
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
141141
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
142142
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v033_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn test_decode_v33_table_meta() -> anyhow::Result<()> {
138138
engine_options: btreemap! {s("abc") => s("def")},
139139
options: btreemap! {s("xyz") => s("foo")},
140140
default_cluster_key: Some("(a + 2, b)".to_string()),
141-
default_cluster_key_id: 0,
141+
cluster_key_seq: 0,
142142
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
143143
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
144144
comment: s("table_comment"),

src/meta/proto-conv/tests/it/v040_table_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn test_decode_v40_table_meta() -> anyhow::Result<()> {
138138
engine_options: btreemap! {s("abc") => s("def")},
139139
options: btreemap! {s("xyz") => s("foo")},
140140
default_cluster_key: Some("(a + 2, b)".to_string()),
141-
default_cluster_key_id: 0,
141+
cluster_key_seq: 0,
142142
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
143143
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
144144
comment: s("table_comment"),

0 commit comments

Comments
 (0)