Re: [HACKERS] Weaker shmem interlock w/o postmaster.pid
Daniel Gustafsson <daniel@yesql.se>
On Saturday, March 9, 2019 8:16 AM, Noah Misch <noah@leadboat.com> wrote: This patch is not really in my wheelhouse, so I might very well be testing it in the wrong way, but whats the fun in staying in shallow end. Below is my attempt at reviewing this patchset. Both patches applies with a little bit of fuzz, and passes check-world. No new perlcritic warnings are introduced, but 016_shm.pl needs to be renamed to 017 since commit b0825d28ea83e44139bd319e6d1db2c499c claimed 016. They absolutely seem to do what they on the tin, and to my understanding this seems like an improvement we definitely want. > I renamed IpcMemoryAnalyze() to PGSharedMemoryAttach() and deleted the old > function of that name. Now, this function never calls shmdt(); the caller is > responsible for that. I do like things better this way. What do you think? I think it makes for a good API for the caller to be responsible, but it does warrant a comment on the function to explicitly state that. A few other small comments: + state = PGSharedMemoryAttach((IpcMemoryId) id2, &memAddress); + if (memAddress) + shmdt(memAddress); This seems like a case where it would be useful to log a shmdt() error or do an Assert() around the success of the operation perhaps? + * Loop till we find a free IPC key. Trust CreateDataDirLockFile() to + * ensure no more than one postmaster per data directory can enter this + * loop simultaneously. (CreateDataDirLockFile() does not ensure that, + * but prefer fixing it over coping here.) This comment make it seem like there is a fix to CreateLockFile() missing to his patch, is that correct? If so, do you have an idea for that patch? > I tested on Red Hat and on Windows Server 2016; I won't be shocked > if the test (not the code under test) breaks on other Windows configurations. IIRC there are Windows versions where Win32::Process::KillProcess is required for this, but thats admittedly somewhat dated knowledge. If the buildfarm goes red on older Windows animals it might be something to look at perhaps. Switching this to Ready for Committer since I can't see anything but tiny things. cheers ./daniel
Commits
-
Probe only 127.0.0.1 when looking for ports on Unix.
- 1ed42e50e963 9.6.14 landed
- 8c7a8e19bb17 10.9 landed
- 1f3bcb497200 11.4 landed
- 8efe710d9c84 12.0 landed
-
Don't write to stdin of a test process that could have already exited.
- e12a4726127b 12.0 cited
-
Test both 0.0.0.0 and 127.0.0.x addresses to find a usable port.
- 9f65081cf74b 9.6.13 landed
- 4543ef36f0ef 10.8 landed
- 0bdf6d635e42 11.3 landed
- 4ab02e815627 12.0 landed
-
MSYS: Translate REGRESS_SHLIB to a Windows file name.
- 31e2caaceea9 11.3 landed
- 9daefff12260 12.0 landed
-
MSYS: Skip src/test/recovery/t/017_shm.pl.
- 6b7906e1d9e7 9.6.13 landed
- 2bc0474792e3 10.8 landed
-
When Perl "kill(9, ...)" fails, try "pg_ctl kill".
- de262941fc9c 11.3 landed
- 61c0962d90d5 10.8 landed
- 55926b0a0917 9.6.13 landed
- 947a35014fdc 12.0 landed
-
Consistently test for in-use shared memory.
- 3ef5e16c6181 9.4.22 landed
- c565de643167 9.5.17 landed
- 808e1e75fb37 9.6.13 landed
- 7ef2b313e649 11.3 landed
- 6d81e3c6526b 10.8 landed
- c098509927f9 12.0 landed
- e7f89a5dec0f 9.5.17 landed
- b2307f8e3184 11.3 landed
- 891e9e0aee53 9.6.13 landed
- 7c414cdc39a3 10.8 landed
- 3a70b66e6257 9.4.22 landed
- 2f932f71d9f2 12.0 landed
-
Revert "Consistently test for in-use shared memory."
- ae98c24fda4b 9.6.13 landed
- 9ec582b64d69 9.5.17 landed
- 7d18a55c90eb 10.8 landed
- 392ea22e9b32 11.3 landed
- 0777696fe346 9.4.22 landed
- 82150a05be0d 12.0 landed
-
Silence -Wimplicit-fallthrough in sysv_shmem.c.
- 0aa0ccfdd653 9.6.13 cited
-
Make src/test/recovery/t/017_shm.pl safe for concurrent execution.
- 0e0d449fb02a 9.6.13 landed
- 3186d5fac55b 10.8 landed
- 1106438c37db 11.3 landed
- 16ee6eaf80a4 12.0 landed
-
Update HINT for pre-existing shared memory block.
- f3461cb8f5b5 9.4.22 landed
- 52e7e4d1dfe6 9.5.17 landed
- e49dc9ab14b2 9.6.13 landed
- ab7590e9197c 11.3 landed
- 327399412d03 10.8 landed
- 5a907404b527 12.0 landed
-
Add WL_EXIT_ON_PM_DEATH pseudo-event.
- cfdf4dc4fc96 12.0 cited
-
The default values for shared_buffers and max_connections are now 1000
- de98a7e23a19 7.4.1 cited
-
XLOG (and related) changes:
- 4d14fe0048cf 7.1.1 cited
-
Significant cleanups in SysV IPC handling (shared mem and semaphores).
- c715fdea2678 7.1.1 cited