Skip to content

Commit 94f3c60

Browse files
committed
fix warehouse uid modify to id
1 parent 1c41631 commit 94f3c60

File tree

6 files changed

+23
-24
lines changed

6 files changed

+23
-24
lines changed

src/meta/app/src/principal/ownership_object.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl fmt::Display for OwnershipObject {
8484
}
8585
OwnershipObject::UDF { name } => write!(f, "UDF {name}"),
8686
OwnershipObject::Stage { name } => write!(f, "STAGE {name}"),
87-
OwnershipObject::Warehouse { id: uid } => write!(f, "Warehouse {uid}"),
87+
OwnershipObject::Warehouse { id } => write!(f, "Warehouse {id}"),
8888
}
8989
}
9090
}
@@ -124,7 +124,7 @@ impl KeyCodec for OwnershipObject {
124124
}
125125
OwnershipObject::Stage { name } => b.push_raw("stage-by-name").push_str(name),
126126
OwnershipObject::UDF { name } => b.push_raw("udf-by-name").push_str(name),
127-
OwnershipObject::Warehouse { id: uid } => b.push_raw("warehouse-by-uid").push_str(uid),
127+
OwnershipObject::Warehouse { id } => b.push_raw("warehouse-by-id").push_str(id),
128128
}
129129
}
130130

@@ -171,13 +171,13 @@ impl KeyCodec for OwnershipObject {
171171
let name = p.next_str()?;
172172
Ok(OwnershipObject::UDF { name })
173173
}
174-
"warehouse-by-uid" => {
175-
let uid = p.next_str()?;
176-
Ok(OwnershipObject::Warehouse { id: uid })
174+
"warehouse-by-id" => {
175+
let id = p.next_str()?;
176+
Ok(OwnershipObject::Warehouse { id })
177177
}
178178
_ => Err(kvapi::KeyError::InvalidSegment {
179179
i: p.index(),
180-
expect: "database-by-id|database-by-catalog-id|table-by-id|table-by-catalog-id|stage-by-name|udf-by-name|warehouse-by-uid"
180+
expect: "database-by-id|database-by-catalog-id|table-by-id|table-by-catalog-id|stage-by-name|udf-by-name|warehouse-by-id"
181181
.to_string(),
182182
got: q.to_string(),
183183
}),

src/meta/app/src/principal/tenant_ownership_object_ident.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ mod tests {
265265
);
266266

267267
let key = role_grantee.to_string_key();
268-
assert_eq!("__fd_object_owners/test/warehouse-by-uid/n87s", key);
268+
assert_eq!("__fd_object_owners/test/warehouse-by-id/n87s", key);
269269

270270
let parsed = TenantOwnershipObjectIdent::from_str_key(&key).unwrap();
271271
assert_eq!(role_grantee, parsed);

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ impl FromToProto for mt::principal::OwnershipObject {
8989
stage,
9090
}) => Ok(mt::principal::OwnershipObject::Stage { name: stage }),
9191
pb::ownership_object::Object::Warehouse(
92-
pb::ownership_object::OwnershipWarehouseObject { uid },
93-
) => Ok(mt::principal::OwnershipObject::Warehouse { id: uid }),
92+
pb::ownership_object::OwnershipWarehouseObject { id },
93+
) => Ok(mt::principal::OwnershipObject::Warehouse { id }),
9494
}
9595
}
9696

@@ -126,9 +126,9 @@ impl FromToProto for mt::principal::OwnershipObject {
126126
stage: name.clone(),
127127
}),
128128
),
129-
mt::principal::OwnershipObject::Warehouse { id: uid } => {
129+
mt::principal::OwnershipObject::Warehouse { id } => {
130130
Some(pb::ownership_object::Object::Warehouse(
131-
pb::ownership_object::OwnershipWarehouseObject { uid: uid.clone() },
131+
pb::ownership_object::OwnershipWarehouseObject { id: id.clone() },
132132
))
133133
}
134134
};

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

-1
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,4 @@ mod v116_marked_deleted_index_meta;
117117
mod v117_webhdfs_add_disable_list_batch;
118118
mod v118_webhdfs_add_user_name;
119119
mod v119_virtual_column;
120-
121120
mod v120_warehouse_ownershipobject;

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ use crate::common;
3838
#[test]
3939
fn test_decode_v120_grant_object() -> anyhow::Result<()> {
4040
let role_info_v120 = vec![
41-
10, 2, 114, 49, 18, 172, 1, 10, 21, 10, 8, 10, 0, 160, 6, 117, 168, 6, 24, 16, 128, 128,
42-
128, 1, 160, 6, 117, 168, 6, 24, 10, 31, 10, 21, 18, 13, 10, 7, 100, 101, 102, 97, 117,
43-
108, 116, 18, 2, 100, 98, 160, 6, 117, 168, 6, 24, 16, 2, 160, 6, 117, 168, 6, 24, 10, 35,
41+
10, 2, 114, 49, 18, 172, 1, 10, 21, 10, 8, 10, 0, 160, 6, 120, 168, 6, 24, 16, 128, 128,
42+
128, 1, 160, 6, 120, 168, 6, 24, 10, 31, 10, 21, 18, 13, 10, 7, 100, 101, 102, 97, 117,
43+
108, 116, 18, 2, 100, 98, 160, 6, 120, 168, 6, 24, 16, 2, 160, 6, 120, 168, 6, 24, 10, 35,
4444
10, 25, 26, 17, 10, 7, 100, 101, 102, 97, 117, 108, 116, 18, 2, 100, 98, 26, 2, 116, 98,
45-
160, 6, 117, 168, 6, 24, 16, 2, 160, 6, 117, 168, 6, 24, 10, 22, 10, 12, 34, 4, 10, 2, 102,
46-
49, 160, 6, 117, 168, 6, 24, 16, 1, 160, 6, 117, 168, 6, 24, 10, 24, 10, 12, 42, 4, 10, 2,
47-
115, 49, 160, 6, 117, 168, 6, 24, 16, 128, 128, 32, 160, 6, 117, 168, 6, 24, 10, 21, 10, 8,
48-
10, 0, 160, 6, 117, 168, 6, 24, 16, 254, 255, 191, 1, 160, 6, 117, 168, 6, 24, 160, 6, 117,
45+
160, 6, 120, 168, 6, 24, 16, 2, 160, 6, 120, 168, 6, 24, 10, 22, 10, 12, 34, 4, 10, 2, 102,
46+
49, 160, 6, 120, 168, 6, 24, 16, 1, 160, 6, 120, 168, 6, 24, 10, 24, 10, 12, 42, 4, 10, 2,
47+
115, 49, 160, 6, 120, 168, 6, 24, 16, 128, 128, 32, 160, 6, 120, 168, 6, 24, 10, 21, 10, 8,
48+
10, 0, 160, 6, 120, 168, 6, 24, 16, 254, 255, 191, 1, 160, 6, 120, 168, 6, 24, 160, 6, 120,
4949
168, 6, 24, 26, 23, 49, 57, 55, 48, 45, 48, 49, 45, 48, 49, 32, 48, 48, 58, 48, 48, 58, 48,
5050
48, 32, 85, 84, 67, 34, 23, 49, 57, 55, 48, 45, 48, 49, 45, 48, 49, 32, 48, 48, 58, 48, 48,
51-
58, 48, 48, 32, 85, 84, 67, 160, 6, 117, 168, 6, 24,
51+
58, 48, 48, 32, 85, 84, 67, 160, 6, 120, 168, 6, 24,
5252
];
5353
let want = || mt::principal::RoleInfo {
5454
name: "r1".to_string(),
@@ -91,7 +91,7 @@ fn test_decode_v120_grant_object() -> anyhow::Result<()> {
9191
};
9292

9393
common::test_pb_from_to(func_name!(), want())?;
94-
common::test_load_old(func_name!(), role_info_v120.as_slice(), 117, want())?;
94+
common::test_load_old(func_name!(), role_info_v120.as_slice(), 120, want())?;
9595

9696
Ok(())
9797
}
@@ -100,7 +100,7 @@ fn test_decode_v120_grant_object() -> anyhow::Result<()> {
100100
fn test_decode_v120_ownership() -> anyhow::Result<()> {
101101
let ownership_info_v120 = vec![
102102
10, 2, 114, 49, 18, 19, 42, 11, 10, 9, 97, 117, 110, 105, 113, 117, 101, 105, 100, 160, 6,
103-
117, 168, 6, 24, 160, 6, 117, 168, 6, 24,
103+
120, 168, 6, 24, 160, 6, 120, 168, 6, 24,
104104
];
105105

106106
let want = || mt::principal::OwnershipInfo {
@@ -110,7 +110,7 @@ fn test_decode_v120_ownership() -> anyhow::Result<()> {
110110
},
111111
};
112112
common::test_pb_from_to(func_name!(), want())?;
113-
common::test_load_old(func_name!(), ownership_info_v120.as_slice(), 117, want())?;
113+
common::test_load_old(func_name!(), ownership_info_v120.as_slice(), 120, want())?;
114114

115115
Ok(())
116116
}

src/meta/protos/proto/ownership.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ message OwnershipObject {
4747
}
4848

4949
message OwnershipWarehouseObject {
50-
string uid = 1;
50+
string id = 1;
5151
}
5252

5353
oneof object {

0 commit comments

Comments
 (0)