@@ -363,8 +363,10 @@ where
363363 }
364364 CreateOption :: CreateOrReplace => {
365365 if req. as_dropped {
366- // CTAS does not call construct_drop_table_txn_operations(),
367- // so validate its existing table here.
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.
368370 let existing_meta =
369371 self . get_pb ( & TableId :: new ( * id. data ) ) . await ?. ok_or_else ( || {
370372 KVAppError :: AppError ( AppError :: UnknownTableId (
@@ -388,21 +390,18 @@ where
388390 ) ) ;
389391 }
390392
391- // Guard the engine check against a concurrent metadata update.
392- txn. condition . push ( txn_cond_seq (
393- & TableId :: new ( * id. data ) ,
394- Eq ,
395- existing_meta. seq ,
396- ) ) ;
393+ // No TableMeta seq condition is needed: the engine is immutable
394+ // for a table id, and the `key_dbid_tbname` condition below ensures
395+ // that the name still refers to this table id.
396+
397397 // If the table is being created as a dropped table, we do not
398398 // need to combine with drop_table_txn operations, just return
399399 // the sequence number associated with the value part of
400400 // the key-value pair (key_dbid_tbname, table_id).
401-
402401 SeqV :: new ( id. seq , * id. data )
403402 } else {
404- // The drop helper validates the engine against the metadata
405- // sequence used by the replacement transaction .
403+ // The drop helper rejects a mismatched engine before it
404+ // marks the existing table as dropped .
406405 let ( seq, id) = construct_drop_table_txn_operations (
407406 self ,
408407 req. name_ident . table_name . clone ( ) ,
0 commit comments