mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
4db3744f1f
This code is intended as a demonstration of how the dynamic shared memory and dynamic background worker facilities can be used to establish a group of coooperating processes which can coordinate their activities using the shared memory message queue facility. By itself, the code does nothing particularly interesting: it simply allows messages to be passed through a loop of workers and back to the original process. But it's a useful unit test, in addition to its demonstration value.
19 lines
564 B
Plaintext
19 lines
564 B
Plaintext
CREATE EXTENSION test_shm_mq;
|
|
--
|
|
-- These tests don't produce any interesting output. We're checking that
|
|
-- the operations complete without crashing or hanging and that none of their
|
|
-- internal sanity tests fail.
|
|
--
|
|
SELECT test_shm_mq(32768, (select string_agg(chr(32+(random()*96)::int), '') from generate_series(1,400)), 10000, 1);
|
|
test_shm_mq
|
|
-------------
|
|
|
|
(1 row)
|
|
|
|
SELECT test_shm_mq_pipelined(16384, (select string_agg(chr(32+(random()*96)::int), '') from generate_series(1,270000)), 200, 3);
|
|
test_shm_mq_pipelined
|
|
-----------------------
|
|
|
|
(1 row)
|
|
|