Re: [HACKERS] WAL logging problem in 9.4.3?
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Wow.. This is embarrassing.. *^^*. At Thu, 21 Nov 2019 16:01:07 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in > I should have replied this first. > > At Sun, 17 Nov 2019 20:54:34 -0800, Noah Misch <noah@leadboat.com> wrote in > > On Tue, Nov 05, 2019 at 02:53:35PM -0800, Noah Misch wrote: > > > I started pre-commit editing on 2019-10-28, and comment+README updates have > > > been the largest part of that. I'll check my edits against the things you > > > list here, and I'll share on-list before committing. I've now marked the CF > > > entry Ready for Committer. > > > > Having dedicated many days to that, I am attaching v24nm. I know of two > > remaining defects: > > > > === Defect 1: gistGetFakeLSN() > > > > When I modified pg_regress.c to use wal_level=minimal for all suites, > > src/test/isolation/specs/predicate-gist.spec failed the assertion in > > gistGetFakeLSN(). One could reproduce the problem just by running this > > sequence in psql: > > > > begin; > > create table gist_point_tbl(id int4, p point); > > create index gist_pointidx on gist_point_tbl using gist(p); > > insert into gist_point_tbl (id, p) > > select g, point(g*10, g*10) from generate_series(1, 1000) g; > > > > I've included a wrong-in-general hack to make the test pass. I see two main > > options for fixing this: > > > > (a) Introduce an empty WAL record that reserves an LSN and has no other > > effect. Make GiST use that for permanent relations that are skipping WAL. > > Further optimizations are possible. For example, we could use a backend-local > > counter (like the one gistGetFakeLSN() uses for temp relations) until the > > counter is greater a recent real LSN. That optimization is probably too > > clever, though it would make the new WAL record almost never appear. > > > > (b) Exempt GiST from most WAL skipping. GiST index build could still skip > > WAL, but it would do its own smgrimmedsync() in addition to the one done at > > commit. Regular GiST mutations would test RELPERSISTENCE_PERMANENT instead of > > RelationNeedsWal(), and we'd need some hack for index_copy_data() and possibly > > other AM-independent code that skips WAL. > > > > Overall, I like the cleanliness of (a). The main argument for (b) is that it > > ensures we have all the features to opt-out of WAL skipping, which could be > > useful for out-of-tree index access methods. (I think we currently have the > > features for a tableam to do so, but not for an indexam to do so.) Overall, I > > lean toward (a). Any other ideas or preferences? > > I don't like (b), too. > > What we need there is any sequential numbers for page LSN but really > compatible with real LSN. Couldn't we use GetXLogInsertRecPtr() in the > case? Or, I'm not sure but I suppose that nothing happenes when > UNLOGGED GiST index gets turned into LOGGED one. Yes, I just forgot to remove these lines when writing the following. > Rewriting table like SET LOGGED will work but not realistic. > > > === Defect 2: repetitive work when syncing many relations > > > > For deleting relfilenodes, smgrDoPendingDeletes() collects a list for > > smgrdounlinkall() to pass to DropRelFileNodesAllBuffers(), which is > > sophisticated about optimizing the shared buffers scan. Commit 279628a > > introduced that, in 2013. I think smgrDoPendingSyncs() should do likewise, to > > further reduce the chance of causing performance regressions. (One could, > > however, work around the problem by raising wal_skip_threshold.) Kyotaro, if > > you agree, could you modify v24nm to implement that? > > Seems reasonable. Please wait a minite. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Commits
-
Add perl2host call missing from a new test file.
- 70de4e950c3b 13.0 landed
-
Skip WAL for new relfilenodes, under wal_level=minimal.
- c6b92041d385 13.0 landed
- 9db4b9da2801 9.5.22 landed
- a653bd8aa76e 9.6.18 landed
- 9d6215205e5a 10.13 landed
- 03b89f1949a9 11.8 landed
- e4b0a02ef8c8 12.3 landed
- cb2fd7eac285 13.0 landed
-
Revert "Skip WAL for new relfilenodes, under wal_level=minimal."
- b31e96ba420f 9.5.22 landed
- 348f15e22e94 9.6.18 landed
- 0a6c9c66da26 10.13 landed
- 63631ee64f84 12.3 landed
- 2fbdebc248ec 11.8 landed
- de9396326edc 13.0 landed
-
Back-patch log_newpage_range().
- e0dd086414f7 9.5.22 landed
- 14d2bb4941e6 9.6.18 landed
- 43434ed94d80 10.13 landed
- ae86e46c3b7b 11.8 landed
-
During heap rebuild, lock any TOAST index until end of transaction.
- a8f754aea014 9.6.18 landed
- 978da2a95597 9.5.22 landed
- 78a34c68920a 10.13 landed
- 88b3a6cd2623 12.3 landed
- 4433c6e8c0a5 11.8 landed
- e629a01f6973 13.0 landed
-
In log_newpage_range(), heed forkNum and page_std arguments.
- a5abec521c5d 12.3 landed
- d3e572855be1 13.0 landed
-
Back-patch src/test/recovery and PostgresNode from 9.6 to 9.5.
- 12034da6cc39 9.5.22 landed
-
Reduce pg_ctl's reaction time when waiting for postmaster start/stop.
- c61559ec3a41 10.0 cited
-
Accelerate end-of-transaction dropping of relations
- 279628a0a7cf 9.3.0 cited
-
Redesign the planner's handling of index-descent cost estimation.
- 31f38f28b00c 9.3.0 cited
-
Make TRUNCATE do truncate-in-place when processing a relation that was created
- cab9a0656c36 9.0.0 cited