[fix](point-query) Refresh stale prepared short-circuit plans#63920
Merged
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
/review |
Contributor
|
OpenCode automated review failed and did not complete. Error: Error: Token refresh failed: 401 Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 31253 ms |
Contributor
TPC-DS: Total hot run time: 172374 ms |
Contributor
FE Regression Coverage ReportIncrement line coverage |
Member
|
/review |
Contributor
There was a problem hiding this comment.
Review result: no blocking issues found in this pass.
Critical checkpoint conclusions:
- Goal and proof: The PR refreshes stale prepared short-circuit point-query plans when cached table metadata is no longer reusable. The added regression coverage exercises rename, drop/recreate, replace, swap, schema change, and string-key cases.
- Scope and clarity: The change is focused on prepared statement context reuse and short-circuit cache invalidation, with no broad unrelated behavior changes observed.
- Concurrency: Prepared statement state is session-scoped through ConnectContext; I did not find new shared cross-session mutable state or new locking requirements.
- Lifecycle: Cached ShortCircuitQueryContext now checks dropped table, schema version, and table-name drift before reuse. Refresh success replaces the prepared context, and refresh failure rolls back executor/prepared state.
- Configuration: No new configuration items.
- Compatibility: No storage format, RPC, Thrift, or persisted metadata compatibility impact found.
- Parallel paths: Reviewed COM_STMT_EXECUTE binding, ExecuteCommand, StmtExecutor context synchronization, PointQueryExecutor direct execution, and OlapScanNode metadata capture; the updated path appears consistently wired.
- Special checks: The reusable check has a concrete purpose: avoiding direct execution against renamed/dropped/recreated schema/table metadata.
- Test coverage: Regression tests were added for the main metadata-change scenarios. I did not run the test suite in this review environment.
- Observability: Existing debug logs around refresh are sufficient for this narrow path; no new metrics appear necessary.
- Transaction/persistence/data writes: The change affects read-side prepared point-query planning/cache reuse only; no edit log or write atomicity impact found.
- FE/BE variable passing: No new FE-to-BE variables were introduced.
- Performance: The fast reusable path is preserved; reparsing/replanning is limited to detected stale short-circuit contexts.
User focus: No additional user-provided review focus was specified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepared point queries cache short-circuit planner state and the associated StatementContext.
When a target table is renamed, replaced, or swapped, the cached plan may still reference stale
table metadata and reuse an outdated StatementContext, causing execution failures or incorrect
table access.
This change tracks the table name captured during planning, checks dropped/renamed/schema-changed
tables before reusing the short-circuit context, and reparses the prepared SQL to rebuild the
prepared plan with a fresh StatementContext when the cached context is stale. Bound placeholder
values and MySQL parameter types are preserved across refresh. Regression coverage is added for
rename, replace, and swap scenarios.