File tree Expand file tree Collapse file tree
src/meta/api/src/api_impl Expand file tree Collapse file tree Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments