Fix smgr_hook bypass in zeroextend and release - #1953
Open
tuhaihe wants to merge 1 commit into
Open
Conversation
smgrrelease() and smgrzeroextend() dispatch through smgrsw[reln->smgr_which] instead of reln->smgr, so an f_smgr installed by smgr_hook is silently bypassed. Both arrived with the REL_16_9 merge in upstream form; every other entry point in smgr.c already goes through reln->smgr. smgrrelease() is harmless for the in-tree managers. smgrzeroextend() is not: it is the bulk-extension path from ExtendBufferedRelShared(), and reaching mdzeroextend() unhooked makes register_dirty_segment() tag the checkpointer fsync request with the un-redirected path. That file never exists, so the next checkpoint PANICs with "could not fsync file ...: No such file or directory" and the segment enters a crash/restart loop. Nothing changes when no hook is installed, since smgropen() sets reln->smgr to &smgrsw[reln->smgr_which]. Assisted-by: Claude Code
reshke
approved these changes
Sep 3, 2026
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.
smgrrelease() and smgrzeroextend() dispatch through smgrsw[reln->smgr_which] instead of reln->smgr, so an f_smgr installed by smgr_hook is silently bypassed. Both arrived with the REL_16_9 merge in upstream form; every other entry point in smgr.c already goes through reln->smgr.
smgrrelease() is harmless for the in-tree managers. smgrzeroextend() is not: it is the bulk-extension path from ExtendBufferedRelShared(), and reaching mdzeroextend() unhooked makes register_dirty_segment() tag the checkpointer fsync request with the un-redirected path. That file never exists, so the next checkpoint PANICs with "could not fsync file ...: No such file or directory" and the segment enters a crash/restart loop.
Nothing changes when no hook is installed, since smgropen() sets reln->smgr to &smgrsw[reln->smgr_which].
Assisted-by: Claude Code
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions