Skip to content

[fix](cache) Follower FE sql cache not invalidated on table metadata replay (#63612)#63658

Merged
yiguolei merged 1 commit into
apache:branch-4.1from
924060929:fix/sql-cache-replay-4.1
May 26, 2026
Merged

[fix](cache) Follower FE sql cache not invalidated on table metadata replay (#63612)#63658
yiguolei merged 1 commit into
apache:branch-4.1from
924060929:fix/sql-cache-replay-4.1

Conversation

@924060929
Copy link
Copy Markdown
Contributor

@924060929 924060929 commented May 26, 2026

Proposed changes

Cherry-pick of #63612.

Follower FEs replay metadata changes (e.g. ALTER TABLE ... RENAME COLUMN) but
never invalidated the sql cache, so stale entries survived and queries returned
wrong results. Since enable_sql_cache defaults to true since 4.0, every
multi-FE deployment is affected.

Two-layer fix

Layer Mechanism Scope Crash window
1 baseSchemaVersion check (new) OlapTable schema DDL (rename/add/drop column) None
2 OP_TABLE_META_CHANGE journal (new) All table types, all DDL Tiny

Layer 1 stores OlapTable.getBaseSchemaVersion() in cache entries and checks
on lookup — lazy validation, zero crash window, automatically covers all DDLs
that bump schemaVersion.

Layer 2 broadcasts OP_TABLE_META_CHANGE via journal on DDL, gated by
enable_write_op_table_meta_change FE config (default false):

  • false: master does local cache invalidation only, no journal write
  • true: broadcasts to all followers

Layer 1 works regardless of the config setting.

@924060929 924060929 requested a review from yiguolei as a code owner May 26, 2026 04:22
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@924060929
Copy link
Copy Markdown
Contributor Author

run buildall

…replay (apache#63612)

Cherry-pick of apache#63612 to branch-4.1.

Two-layer fix:
1. Check OlapTable.baseSchemaVersion on cache lookup (lazy, no crash window)
2. OP_TABLE_META_CHANGE journal broadcast (eager, all table types)

Add enable_write_op_table_meta_change FE config (default false) to gate
the OP_TABLE_META_CHANGE edit log writing. When false, master still does
local cache invalidation but does not broadcast to followers via journal.
The schemaVersion check still works regardless of this config.
@924060929 924060929 force-pushed the fix/sql-cache-replay-4.1 branch from 02ab5fd to e2ace1f Compare May 26, 2026 09:10
@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 48.86% (43/88) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 57.95% (51/88) 🎉
Increment coverage report
Complete coverage report

@yiguolei yiguolei merged commit 01df440 into apache:branch-4.1 May 26, 2026
28 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants