Re: "38.10.10. Shared Memory and LWLocks" may require a clarification

Поиск
Список
Период
Сортировка
От Aleksander Alekseev
Тема Re: "38.10.10. Shared Memory and LWLocks" may require a clarification
Дата
Msg-id CAJ7c6TNyZiqWv4We76FjNPQkwtna65yKwaVErwWjv+JyLEnbpA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: "38.10.10. Shared Memory and LWLocks" may require a clarification  (Aleksander Alekseev <aleksander@timescale.com>)
Ответы Re: "38.10.10. Shared Memory and LWLocks" may require a clarification  (Aleksander Alekseev <aleksander@timescale.com>)
Список pgsql-hackers
Hi,

> Since no one seems to object so far I prepared the patch.

Turned out patch v1 fails on cfbot on Windows due to extra Assert I added [1]:

```
abort() has been calledTRAP: failed Assert("!IsUnderPostmaster"),
File: "../src/backend/storage/ipc/ipci.c", Line: 320, PID: 4040
abort() has been calledTRAP: failed Assert("!IsUnderPostmaster"),
File: "../src/backend/storage/ipc/ipci.c", Line: 320, PID: 3484
```

Which indicates that currently shmem_startup_hook **can** be called by
child processes on Windows. Not 100% sure if this is a desired
behavior considering the fact that it is inconsistent with the current
behavior on *nix systems.

Here is patch v2. Changes comparing to v1:

```
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -311,15 +311,8 @@ CreateSharedMemoryAndSemaphores(void)
        /*
         * Now give loadable modules a chance to set up their shmem allocations
         */
-       if (shmem_startup_hook)
-       {
-               /*
-                * The following assert ensures that
shmem_startup_hook is going to be
-                * called only by the postmaster, as promised in the
documentation.
-                */
-               Assert(!IsUnderPostmaster);
+       if (!IsUnderPostmaster && shmem_startup_hook)
                shmem_startup_hook();
-       }
 }
```

Thoughts?

[1]:
https://api.cirrus-ci.com/v1/artifact/task/4924036300406784/testrun/build/testrun/pg_stat_statements/regress/log/postmaster.log

-- 
Best regards,
Aleksander Alekseev

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Aleksander Alekseev
Дата:
Сообщение: Re: RFI: Extending the TOAST Pointer
Следующее
От: "Tristan Partin"
Дата:
Сообщение: Make pgbench exit on SIGINT more reliably