Skip to content

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

Open
924060929 wants to merge 1 commit into
apache:branch-4.0from
924060929:fix/sql-cache-replay-4.0
Open

[fix](cache) Follower FE sql cache not invalidated on table metadata replay (#63612)#63657
924060929 wants to merge 1 commit into
apache:branch-4.0from
924060929:fix/sql-cache-replay-4.0

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.

@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.0.

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.0 branch from 4436288 to 0591da6 Compare May 26, 2026 09:13
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.

2 participants