- Notifications
You must be signed in to change notification settings - Fork5k
Commit00066aa
committed
md: Add comment & assert to buffer-zeroing path in md[start]readv()
mdreadv() has a codepath to zero out buffers when a read returns zero bytes,guarded by a check for zero_damaged_pages || InRecovery.The InRecovery codepath to zero out buffers in mdreadv() appears to beunreachable. The only known paths to reach mdreadv()/mdstartreadv() inrecovery are XLogReadBufferExtended(), vm_readbuf(), and fsm_readbuf(), eachof which takes care to extend the relation if necessary. This looks to eitherhave been the case for a long time, or the code was never reachable.The zero_damaged_pages path is incomplete, as missing segments are notcreated.Putting blocks into the buffer-pool that do not exist on disk is ratherproblematic, as such blocks will, at least initially, not be found by scansthat rely on smgrnblocks(), as they are beyond EOF. It also can cause weirdproblems with relation extension, as relation extension does not expect blocksbeyond EOF to exist.Therefore we would like to remove that path.mdstartreadv(), which I added ine5fe570, does not implement this zeroinglogic. I had started a discussion about that a while ago (linked below), butforgot to act on the conclusion of the discussion, namely to disable thein-memory-zeroing behavior.We could certainly implement equivalent zeroing logic in mdstartreadv(), butit would have to be more complicated due to potential differences in thezero_damaged_pages setting between the definer and completor of IO. Given thatwe want to remove the logic, that does not seem worth implementing thenecessary logic.For now, put an Assert(false) and comments documenting this choice intomdreadv() and comments documenting the deprecation of the path in mdreadv()and the non-implementation of it in mdstartreadv(). If we, during testing,discover that we do need the path, we can implement it at that time.Reviewed-by: Noah Misch <noah@leadboat.com>Discussion:https://postgr.es/m/postgr.es/m/20250330024513.ac.nmisch@google.comDiscussion:https://postgr.es/m/postgr.es/m/3qxxsnciyffyf3wyguiz4besdp5t5uxvv3utg75cbcszojlz7p@uibfzmnukkbd1 parent93bc3d7 commit00066aa
1 file changed
+28
-0
lines changedLines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
910 | 910 |
| |
911 | 911 |
| |
912 | 912 |
| |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
913 | 932 |
| |
914 | 933 |
| |
915 | 934 |
| |
| 935 | + | |
| 936 | + | |
916 | 937 |
| |
917 | 938 |
| |
918 | 939 |
| |
| |||
1007 | 1028 |
| |
1008 | 1029 |
| |
1009 | 1030 |
| |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
1010 | 1038 |
| |
1011 | 1039 |
| |
1012 | 1040 |
| |
|
0 commit comments
Comments
(0)