[Bug]: Scoped information_schema.TABLES AUTO_INCREMENT read fails with 1146 when another database drops its same-named table

Open
#33,365 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@LeftHandCold is already working on this.

Since Nov 27, 2026.

  • #33372 by @LeftHandCold — open

Assessment

This issue has not been assessed yet.

Description

kind/bug severity/s0
Is there an existing issue for the same bug?
  • I have checked the existing issues. #16888 is a related historical symptom, not this scoped read racing a DROP of another base table.
Branch Name

main

Commit ID

df5de1444b222fa9ac53f648715f1b29a0354161 (failing nightly) and afe647f60fbf1393a51d94ce84a1abb676aaaf99 (previous nightly; independently reproduced on both exact images).

Introducing change for this scoped read: #27942 (September 4). Verified by building and exercising its exact first parent and merge, not inferred from the nightly timing.

Actual Behavior

A read of the AUTO_INCREMENT value of a stable table fails with error 1146 naming the physical ID of a different database's concurrently dropped table. No DDL, inserts, subscriptions, failover, or cache misses are required on the target table. Single-node MO and two ordinary SQL connections suffice.

Failed Main MOTR; previous passing run. UTC on 2026-11-26: target DB suffix _7, table t, ID 275061; TN handled DROP of _12.t, ID 275054 at 23:44:51.285350; the CN logged eviction of 275054 at .289373, then returned no such table .275054 at .329207. Client statement ID 01a21a3f-6238-7588-a1ae-813bd50e151a. Error from SQL execution, not a comparison of returned values.

Expected Behavior

Every read returns the target's value (10 in this test). A committed DROP in B should neither invalidate A's observation nor require the caller to retry.

Steps to Reproduce

Use two connections, same account, autocommit. Create databases A and B. In each create t(id BIGINT AUTO_INCREMENT PRIMARY KEY, v INT) AUTO_ID_CACHE=1 AUTO_INCREMENT=10 (use starting value 200 in B). Do not modify A.t.

  1. Session A: USE A, repeatedly run SELECT auto_increment FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='t'.
  2. Session B: USE B, record SELECT rel_id FROM mo_catalog.mo_tables WHERE reldatabase=DATABASE() AND relname='t'; DROP TABLE t; recreate the same B table; repeat. Run concurrently, allowing ~25 ms before each DROP.
  3. Compare the numeric ID in A's first 1146 with B's recorded IDs. Stop B, verify A's original ID and its result again.
Isolated exact image A read successes before first 1146 A table ID ID in error After writer stopped
afe647f60f 4 272559 272561 (B) same A ID, value 10
df5de1444b 5 272559 272561 (B) same A ID, value 10

Exact historical parent/merge A/B: fresh isolated single-node instances, same host, toolchain, native libs, config and two-session driver. The historical DDL deliberately omits the later AUTO_ID_CACHE option on both builds; A starts at 10 and B at 200. No faults injected.

Version Result under concurrent DROP Shape of EXPLAIN, from input to output
Parent afc96e9380 1,498/1,498 correct A reads, 100 B drop/recreates schema filter before local projection; no union
Merge fa829e5c50 12 successful A reads, then 1146 on the first B drop. A ID 272564 remained unchanged; the error named B ID 272566; A returned 10 again local projection before UNION ALL, then schema filter

The default cache in this historical A/B also reproduces it: not a new AUTO_ID_CACHE=1 allocator bug. #27942 brought this specific cross-database failure into reach by changing the built-in view shape, not by changing allocator code. This is not a claim about every possible 1146 from metadata enumeration.

Additional information

On both images EXPLAIN puts the table-name predicate on the catalog scan, but the schema predicate TABLE_SCHEMA=DATABASE() above the UNION ALL. The local branch projects internal_auto_increment(reldatabase,relname) before applying the schema filter. It can therefore observe B.t even though B.t cannot contribute a result. Relation lookup uses the query transaction; the function then asks the live committed allocator for that table ID. Once B's DROP commits, this call can report the missing ID and abort the whole read.

Two targeted controls on df5de14, no retry logic: (1) literal schema instead of DATABASE(), 512 correct reads during 100 drops; (2) same DATABASE() but local SELECT arm only, 651 correct reads during 100 drops. The latter changes only the SQL shape under test, not the server binary. #27942 added the UNION ALL for subscribed tables; #27448 previously introduced the volatile set-operation pushdown guard. These are not reasons to revert subscription visibility or broadly relax volatile predicate handling. None of the 16 commits between these two nights first introduced the observed symptom. No evidence of table/data loss or a corrupted allocator.

Dominant language
Go
Stars
1.9k
Forks
312
Avg merge
22h 59m
Merged PRs (30d)
736

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matrixorigin/matrixone

All issues in matrixorigin/matrixone

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.