Skip to content

Commit f578082

Browse files
committed
fix review comments
1 parent 9b8ad34 commit f578082

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/meta/api/src/api_impl/schema_api.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ pub async fn construct_drop_table_txn_operations(
235235
);
236236

237237
let mut tb_meta = tb_meta.unwrap();
238+
// CREATE OR REPLACE passes `expected_engine` to prevent replacing an existing
239+
// table with a different engine. Reject the mismatch before this helper marks
240+
// the existing table as dropped; ordinary DROP operations pass `None`.
238241
if let Some(expected_engine) = expected_engine {
239242
if !tb_meta.engine.eq_ignore_ascii_case(expected_engine) {
240243
return Err(KVAppError::AppError(

src/meta/api/src/api_impl/table_api.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,12 @@ where
363363
}
364364
CreateOption::CreateOrReplace => {
365365
if req.as_dropped {
366-
// Atomic CTAS keeps the existing table visible while the insert
367-
// pipeline runs, so it cannot use the drop helper. Validate the
368-
// engine here; `commit_table_meta()` publishes the replacement
369-
// after the insert succeeds.
366+
// CREATE OR REPLACE must not replace an existing table with a
367+
// different engine. Atomic CTAS keeps the existing table visible
368+
// while the insert pipeline runs, so it cannot use the drop helper
369+
// that normally enforces this rule. Validate the engine here;
370+
// `commit_table_meta()` publishes the replacement after the insert
371+
// succeeds.
370372
let existing_meta =
371373
self.get_pb(&TableId::new(*id.data)).await?.ok_or_else(|| {
372374
KVAppError::AppError(AppError::UnknownTableId(

0 commit comments

Comments
 (0)