Re: Is this a problem in GenericXLogFinish()?
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers@postgresql.org
Date: 2023-09-26T23:13:32Z
Lists: pgsql-hackers
Attachments
- v2-0001-Fix-GenericXLogFinish.patch (text/x-patch) patch v2-0001
On Wed, 2023-09-27 at 00:14 +0300, Heikki Linnakangas wrote: > Looks correct. You now loop through all the block IDs three times, > however. I wonder if that is measurably slower, but even if it's not, > was there a reason you wanted to move the XLogRegisterBuffer() calls > to > a separate loop? I did so to correspond more closely to what's outlined in the README and in other places in the code, where marking the buffers dirty happens before XLogBeginInsert(). It didn't occur to me that one extra loop would matter, but I can combine them again. It would be a bit more concise to do the XLogBeginInsert() first (like before) and then register the buffers in the same loop that does the writes and marks the buffers dirty. Updated patch attached. > > Hmm, I'm sure there are exceptions but log_newpage_range() actually > seems to be doing the right thing; it calls MarkBufferDirty() before > XLogInsert(). It only calls it after XLogRegisterBuffer() though, and > I > concur that XLogRegisterBuffer() would be the logical place for the > assertion. We could tighten this up, require that you call > MarkBufferDirty() before XLogRegisterBuffer(), and fix all the > callers. That site is pretty trivial to fix, but there are also a couple places in hash.c and hashovfl.c that are registering a clean page and it's not clear to me exactly what's going on. Regards, Jeff Davis
Commits
-
Fix inconsistency with replay of hash squeeze record for clean buffers
- f56a9def71bb 17.0 landed
-
Set LSN for wbuf in _hash_freeovflpage() iff wbuf is modified.
- aa5edbe379d6 17.0 landed
-
Fix an uninitialized access in hash_xlog_squeeze_page().
- f66fcc5cd616 17.0 landed
-
Use REGBUF_NO_CHANGE at one more place in the hash index.
- 861f86beea1c 17.0 landed
-
Assert that buffers are marked dirty before XLogRegisterBuffer().
- 00d7fb5e2e39 17.0 landed
-
Fix bug in GenericXLogFinish().
- 04f0baa85865 11.22 landed
- 6dbd01b9fdad 12.17 landed
- 469d367bee2f 13.13 landed
- 6615bb95af2d 14.10 landed
- b9bb02620d4b 15.5 landed
- b8963e8a2854 16.1 landed
- ef74c7197c04 17.0 landed
-
Improve hash index bucket split behavior.
- 6d46f4783efe 10.0 cited