Skip to content

[Bug]: CREATE FULLTEXT INDEX can be invisible to another CN immediately after successful DDL #28286

Closed

Description

@LeftHandCold

Is there an existing issue for the same bug?

  • I searched MatrixOne issues created during the last week for FULLTEXT, concurrent DDL, cross-CN metadata visibility, and the exact error text. No matching issue was found.

Branch Name

main

Commit ID

845fff8ee9cac962c5002a1007e0b0180efd591b

Other Environment Information

Actual Behavior

CREATE FULLTEXT INDEX waits for a concurrent writer transaction, completes successfully after that writer rolls back, and the TN successfully creates and populates the hidden FULLTEXT table. A new query started immediately afterwards through another CN intermittently fails with:

ERROR 20105 (HY000): not supported: MATCH() AGAINST() function cannot be replaced by FULLTEXT INDEX and full table scan with fulltext search is not supported yet.

The same run completed the first three fulltext rollback rounds successfully. In round 4, the regular-index commit/rollback cases and the fulltext commit case passed, while the fulltext rollback verification failed:

ISSUE_27487_CASE_PASS run=4 index=regular outcome=commit
ISSUE_27487_CASE_PASS run=4 index=regular outcome=rollback
ISSUE_27487_CASE_PASS run=4 index=fulltext outcome=commit
ISSUE_27487_FAIL: (20105, 'not supported: MATCH() AGAINST() function cannot be replaced by FULLTEXT INDEX and full table scan with fulltext search is not supported yet.')

This failure occurs before the driver can compare the FULLTEXT result with the equivalent base-table LIKE result. No missing index rows, data loss, or persistent index corruption was established by this incident.

Expected Behavior

Once CREATE FULLTEXT INDEX returns successfully, a transaction started afterwards on any CN must resolve the committed FULLTEXT index metadata and plan the top-level MATCH() AGAINST() query through that index. The caller must not need a sleep, synccommit, or same-CN routing after successful DDL.

Steps to Reproduce

1. Start MatrixOne with at least two CNs and one TN.
2. Create a table with 1,000 rows:

   CREATE TABLE fulltext_docs_rollback (
     id BIGINT PRIMARY KEY,
     body TEXT
   );
   INSERT INTO fulltext_docs_rollback
   SELECT result, CONCAT('officialracezebra ', result)
   FROM generate_series(1, 1000) g;

3. On writer CN-A, begin a transaction and insert one additional row without committing. Confirm through `mo_locks()` that it holds the `mo_tables` shared metadata lock.
4. On CN-B, start `CREATE FULLTEXT INDEX ft_body ON fulltext_docs_rollback(body)` and confirm that it is waiting on the same metadata lock.
5. Roll back the writer transaction on CN-A and wait for CREATE INDEX on CN-B to return success.
6. Immediately open/use a verifier connection through Proxy or a different CN and run:

   SET experimental_fulltext_index = 1;
   SELECT COUNT(*) FROM fulltext_docs_rollback
   WHERE MATCH(body) AGAINST('officialracezebra');

7. Repeat the commit/rollback matrix. The referenced nightly driver runs regular/FULLTEXT x commit/rollback for ten rounds and reproduced this failure in the fourth FULLTEXT rollback round.

Additional information

Confirmed timeline

All timestamps below are UTC on 2026-09-06:

  • 04:53:48.399-04:53:48.408: the verifier CN subscribes the base table (table_id=673355, database_id=673448).
  • The DDL runs on a different CN.
  • 04:53:49.058596: the TN-side index population statement finishes and reports 3,000 affected posting rows for the hidden __mo_index_secondary_* table.
  • 04:53:49.072685: a new verifier transaction begins on another CN and executes the top-level MATCH() AGAINST() query.
  • 04:53:49.090: planning/execution returns error 20105.

The query starts about 14 ms after the hidden-table population finishes and only after the DDL connection has returned success.

Code path

At the incident commit, findMatchFullTextIndex can rewrite MATCH() only when scanNode.TableDef.Indexes contains a matching FULLTEXT definition with TableExist=true. If no usable definition is found, it returns nil and leaves the scalar function unreplaced. The unreplaced function reaches fullTextMatch, which returns error 20105.

The query shape is the same top-level FULLTEXT predicate that passed in the preceding rounds. Combined with the successful TN-side hidden-table creation/population, this proves the immediate verifier plan did not receive a usable committed FULLTEXT definition. The exact internal last hop still needs directed evidence: stale TableDef, TableExist=false, catalog cache publication, or logtail/application watermark.

Related but not duplicate

Impact

  • Confirmed: an immediately following query can fail even though CREATE FULLTEXT INDEX returned success.
  • Not observed: base-data loss, persistent hidden-index corruption, panic, or service restart.
  • Likely recovery is metadata convergence or replanning, but that was not measured because the regression driver stops on the first failure.

Acceptance criteria

  1. After successful CREATE FULLTEXT INDEX, a new transaction on every CN immediately sees a matching TableDef.Indexes entry with TableExist=true.
  2. The existing cross-CN regular/FULLTEXT x writer commit/rollback matrix passes repeatedly without sleeps or manual synccommit.
  3. FULLTEXT verification must assert both plan/index usability and exact equality with the base-table control.
  4. Add a deterministic delayed-catalog/logtail test that records DDL commit TS, verifier snapshot TS, applied/catalog watermark, table-definition version, and index definitions.

Activity

  1. added
    kind/bug
    severity/s0
    and removed on Sep 6, 2026
  2. LeftHandCold commented on Sep 6, 2026

    @LeftHandCold
    CollaboratorAuthor

    Root cause is confirmed and fixed by #28289.

    Confirmed failure chain

    1. CREATE FULLTEXT INDEX commits successfully on one CN and the hidden index table is populated.
    2. A verifier query on another CN has already compiled with an older base-table TableDef that does not contain the new FULLTEXT index.
    3. Planner-side FULLTEXT rewrite therefore does not happen, leaving the unresolved fulltext_match runtime placeholder in the SELECT plan.
    4. Ordinary SELECT previously enabled pre-pipeline mo_tables metadata validation only for plans containing Node_LOCK_OP. This MATCH query has no lock node, so it bypasses the catalog-version fence.
    5. The stale plan executes after DDL commit and the placeholder returns 20105, MATCH() AGAINST() ... cannot be replaced by FULLTEXT INDEX.

    This explains why the first scenarios pass, why DDL/index population are already complete, and why only a cross-CN immediate verification can fail. It is a transient schema-visibility/plan-validation bug, not missing index data.

    Deterministic proof

    The regression test uses two CNs and pauses the query only after its stale unresolved FULLTEXT plan has been compiled. The other CN then fully commits CREATE FULLTEXT INDEX; only afterward is the query released.

    • With fix(fulltext): validate stale cross-CN plans before execution #28289, existing mo_tables lock validation observes the post-snapshot DDL commit, advances the RC snapshot, returns ErrTxnNeedRetryWithDefChanged, and the rebuilt MATCH plan succeeds.
    • As a counterfactual, disabling only the new metadata-lock decision makes the same ordering fail deterministically with the incident's exact 20105 error after DDL has committed.

    The fix is deliberately limited to SELECT plans that still contain unresolved fulltext_match or fulltext_match_score. Rewritten FULLTEXT queries and ordinary SELECTs do not gain an extra metadata lock; a genuine MATCH query without an index retains the original error semantics.

  3. added a commit that references this issue on Sep 7, 2026
    a989dab
  4. added 3 commits that reference this issue on Sep 17, 2026
    da5159e
    092b36c
    0dee0d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions