Skip to content

[Bug]: Pessimistic SI DROP DATABASE is rejected in explicit transactions #29417

Closed as not planned

Description

@XuPeng-SH

Disposition (2026-09-28)

Closed as not planned under the current lifecycle contract, rather than fixed. Production and active PR BVT primarily exercise pessimistic RC; the RC path admits these lifecycle statements. For an existing pessimistic SI transaction, rejecting persistent DROP DATABASE is intentional: the object/privilege lifecycle design explicitly limits admission to pessimistic RC. Fresh/autocommit lifecycle owners are forced to pessimistic RC by the same contract.

The reproduction below remains valid evidence of this unsupported SI operation, not evidence of a regression in the current RC product path. #29400 is the separate, reproducible RC performance problem of an unrelated DDL waiting on the global SNAPSHOT gate; it does not require enabling SI DROP DATABASE. If fixed-snapshot SI lifecycle DDL becomes an explicit product requirement, reopen or file a scoped capability request with a complete conflict protocol and actual-SI tests. Do not remove the guard alone.


Summary

DROP DATABASE in an existing explicit pessimistic SI transaction is rejected before planning with ERROR 20105: object lifecycle statements require an existing pessimistic RC transaction. Under an SI-configured service, an autocommit lifecycle statement is instead forced to a new pessimistic RC transaction. This is existing origin/main behavior under the documented RC-only lifecycle contract. A test run on an SI-configured service that only uses autocommit DROP does not validate SI lifecycle correctness.

Public reproduction and scope

On an isolated one-CN/TN/logservice service with [cn.txn] mode="pessimistic", isolation="SI" and cn.frontend.skipCheckPrivilege=false, using sys root:

CREATE DATABASE qa29400_base_si_guard;
BEGIN;
SELECT COUNT(*) FROM mo_catalog.mo_database WHERE datname='qa29400_base_si_guard';
DROP DATABASE qa29400_base_si_guard;
-- ERROR 20105 (HY000): not supported: object lifecycle statements require an existing pessimistic RC transaction

The database remains. A separate autocommit DROP DATABASE qa29400_base_si_guard succeeds and the physical catalog row count becomes zero. The owned service exited cleanly. The exact old binary was SHA256 eb8429f5b66093bb3361202a8559e1c3e0f1fd344ee9aa5a8fd45e759606080f; output SHA256: explicit read 4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865, error bcade9fd94a25e2f0cbd2c35920f74ecc3610427b68d3f3544a8f35955c7dbb4, cleanup 9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa under /private/tmp/mo29400-pub-qa.

A candidate #29400 BVT run under the same SI configuration had 32/35 comparisons pass. Its two explicit-transaction DROP statements received this same error, and the expected own CREATE/DROP count was consequently 1 instead of 0. That is not evidence of a defect in the bounded publication-predicate change; that change does not edit the transaction policy. Autocommit named-publication controls on the SI-configured candidate passed, but used an RC owner by the source rule below.

Source cause (unchanged from origin/main)

pkg/frontend/txn.go:559–566 rejects any forcePessimisticObjectLifecycle statement when an active transaction is not pessimistic RC. pkg/frontend/mysql_cmd_executor.go sets that option for lifecycle DDL before the planner/statement handler. pkg/frontend/txn.go:797–805 gives newly created/autocommit lifecycle owners WithTxnMode(Pessimistic) and WithTxnIsolation(RC) even if the configured isolation is SI. Existing TestObjectLifecycleRejectsExistingUnsafeTxn asserts the rejection. The two frontend source files are byte-identical between the verified origin/main base and the #29400 worktree (txn.go SHA256 b1894f3e6267db5125336c34d22588bcee247377da7bb5a86046c1994df89a38; mysql_cmd_executor.go ab9f6f5cfe939f3825d7a04b4ddff06051ce3befd4c7b938b74292c2bf57755d).

Only explicit SI DROP DATABASE was reproduced here. Comments/selection code also route CREATE OR REPLACE VIEW and object-scoped GRANT through this lifecycle mode policy; their public SI outcomes need separate controls.

Future SI capability, if explicitly requested

The following is a former repair proposal, not a current #29400 requirement. If support is later requested, an explicit SI owner would need to execute supported lifecycle DDL with its actual SI snapshot, preserving prior accepted statements, and publish or fail atomically. Autocommit under an SI policy would need an explicit, tested mode decision rather than silently serving as an RC substitute in SI validation.

Do not merely delete the current guard or change it to accept SI under the old global lock protocol. A possible future scoped R/D/Q witness design would first need to ensure: the DROP and every conflicting publisher must write the same physical D witness in their own transaction. At fixed SI, a post-snapshot completed writer must cause an ordinary write-write conflict at the witness; no RC refresh is permitted. Retain typed cancellation, rollback and statement-owner semantics. Then remove/rework the RC-only admission and forced-RC option for the proven SI paths.

QA should assert the actual transaction metadata/isolation for both explicit and autocommit cases, run two-CN SI schedules in both commit orders (including a writer completed before the stale owner reaches admission), retry/cancel/statement failure followed by outer COMMIT, same-name physical reincarnation, cross-account publication, and ordinary unrelated-database progress. These checks would be required before claiming fixed-SI lifecycle support; they are not acceptance criteria for #29400's current RC convoy fix.

Activity

  1. self-assigned this
    on Sep 27, 2026
  2. added
    kind/bug
    severity/s0
    and removed
    severity/s0
    on Sep 27, 2026
  3. XuPeng-SH commented on Sep 28, 2026

    @XuPeng-SH
    ContributorAuthor

    Closing under the current lifecycle contract: explicit pessimistic SI DROP DATABASE is intentionally unsupported, while the production/active PR BVT path uses pessimistic RC. The RC convoy/performance defect remains open in #29400; its scope has been clarified and does not require SI DROP support. Reopen or file a scoped capability request if fixed-snapshot SI lifecycle DDL becomes a product requirement. This closure is not a code fix or a claim that SI now works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions