Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing default citus.local_shared_pool_size calculation #7640

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ GetLocalSharedPoolSize(void)
{
if (LocalSharedPoolSize == ADJUST_POOLSIZE_AUTOMATICALLY)
{
return GetMaxClientConnections() * 0.5;
return GetMaxClientConnections();
}

return LocalSharedPoolSize;
Expand Down
39 changes: 39 additions & 0 deletions src/test/regress/expected/single_node.out
Original file line number Diff line number Diff line change
Expand Up @@ -2561,6 +2561,45 @@ SELECT pg_reload_conf();
t
(1 row)

/*
* test for the citus.local_shared_pool_size value when a regular user & superuser are querying it.
*/
ALTER SYSTEM SET citus.max_client_connections TO 80;
ALTER SYSTEM SET citus.local_shared_pool_size TO 0;
SELECT pg_reload_conf();
pg_reload_conf
---------------------------------------------------------------------
t
(1 row)

CREATE ROLE user_1 WITH LOGIN;
GRANT pg_read_all_settings TO user_1;
SET ROLE user_1;
/* should output 80, as this is the citus.max_client_connections value and a regular user is querying it. */
SHOW citus.local_shared_pool_size;
citus.local_shared_pool_size
---------------------------------------------------------------------
80
(1 row)

SET ROLE postgres;
/* should output 100, as this is the postgresql default for max_connections and the superuser is querying it. */
SHOW citus.local_shared_pool_size;
citus.local_shared_pool_size
---------------------------------------------------------------------
100
(1 row)

DROP ROLE user_1;
ALTER SYSTEM RESET citus.max_client_connections;
ALTER SYSTEM RESET max_connections;
ALTER SYSTEM RESET citus.local_shared_pool_size;
SELECT pg_reload_conf();
pg_reload_conf
---------------------------------------------------------------------
t
(1 row)

-- suppress notices
SET client_min_messages TO error;
-- cannot remove coordinator since a reference table exists on coordinator and no other worker nodes are added
Expand Down
24 changes: 24 additions & 0 deletions src/test/regress/sql/single_node.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,31 @@ ALTER SYSTEM RESET citus.distributed_deadlock_detection_factor;
ALTER SYSTEM RESET citus.local_shared_pool_size;
SELECT pg_reload_conf();

/*
* test for the citus.local_shared_pool_size value when a regular user & superuser are querying it.
*/
ALTER SYSTEM SET citus.max_client_connections TO 80;
ALTER SYSTEM SET citus.local_shared_pool_size TO 0;
SELECT pg_reload_conf();

CREATE ROLE user_1 WITH LOGIN;
GRANT pg_read_all_settings TO user_1;
SET ROLE user_1;

/* should output 80, as this is the citus.max_client_connections value and a regular user is querying it. */
SHOW citus.local_shared_pool_size;

SET ROLE postgres;

/* should output 100, as this is the postgresql default for max_connections and the superuser is querying it. */
SHOW citus.local_shared_pool_size;

DROP ROLE user_1;

ALTER SYSTEM RESET citus.max_client_connections;
ALTER SYSTEM RESET max_connections;
ALTER SYSTEM RESET citus.local_shared_pool_size;
SELECT pg_reload_conf();

-- suppress notices
SET client_min_messages TO error;
Expand Down