Skip to content

Commit 89dfc47

Browse files
committed
de-dup
1 parent 6bb7bcf commit 89dfc47

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/meta/api/src/schema_api.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,18 @@ pub async fn construct_drop_table_txn_operations(
243243
// 3. The transaction ensures atomicity - either all references are deleted or none
244244
//
245245
// This avoids the overhead of reading each reference's seq while maintaining correctness.
246-
247-
// Delete masking policy references
248-
for policy_map in tb_meta.column_mask_policy_columns_ids.values() {
249-
txn.if_then
250-
.push(txn_op_del(&MaskPolicyTableIdIdent::new_generic(
251-
tenant.clone(),
252-
MaskPolicyIdTableId {
253-
policy_id: policy_map.policy_id,
254-
table_id,
255-
},
256-
)));
257-
}
246+
let policy_ids: HashSet<u64> = tb_meta
247+
.column_mask_policy_columns_ids
248+
.values()
249+
.map(|policy_map| policy_map.policy_id)
250+
.collect();
251+
252+
txn.if_then.extend(policy_ids.into_iter().map(|policy_id| {
253+
txn_op_del(&MaskPolicyTableIdIdent::new_generic(
254+
tenant.clone(),
255+
MaskPolicyIdTableId { policy_id, table_id },
256+
))
257+
}));
258258

259259
// Delete row access policy reference
260260
if let Some(policy_map) = &tb_meta.row_access_policy_columns_ids {

0 commit comments

Comments
 (0)