mirror of https://github.com/citusdata/citus.git
Fixes review comments
parent
01fb7c7db3
commit
25d6e8d4d9
|
@ -106,7 +106,7 @@ AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt)
|
|||
DefElem *def = castNode(DefElem, lfirst(cell));
|
||||
if (strcmp(def->defname, "is_template") == 0)
|
||||
{
|
||||
appendStringInfo(buf, "%s %s", quote_identifier(def->defname),
|
||||
appendStringInfo(buf, "%s %s", quote_identifier(def->defname),
|
||||
quote_literal_cstr(strVal(def->arg)));
|
||||
}
|
||||
else if (strcmp(def->defname, "connection_limit") == 0)
|
||||
|
@ -121,14 +121,9 @@ AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt)
|
|||
else
|
||||
{
|
||||
ereport(ERROR,
|
||||
errmsg("unrecognized AlterDatabaseStmt option: %s",
|
||||
errmsg("unrecognized ALTER DATABASE option: %s",
|
||||
def->defname));
|
||||
}
|
||||
|
||||
if (cell != list_tail(stmt->options))
|
||||
{
|
||||
appendStringInfo(buf, ", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
--since ALLOW_CONNECTIONS alter option should be executed in a different database
|
||||
-- and since we don't have a multiple database support for now,
|
||||
-- this statement will get error
|
||||
|
@ -5,61 +7,73 @@ alter database regression ALLOW_CONNECTIONS false;
|
|||
ERROR: ALLOW_CONNECTIONS is not supported
|
||||
DO $$
|
||||
declare
|
||||
v_connlimit numeric;
|
||||
v_connlimit_initial numeric;
|
||||
v_connlimit_fetched int;
|
||||
begin
|
||||
select datconnlimit into v_connlimit from pg_database where datname = 'regression';
|
||||
select datconnlimit into v_connlimit_initial from pg_database where datname = 'regression';
|
||||
alter database regression with CONNECTION LIMIT 100;
|
||||
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
|
||||
raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched;
|
||||
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit;
|
||||
raise notice 'v_connlimit_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
|
||||
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit_initial;
|
||||
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
|
||||
raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched;
|
||||
raise notice 'v_connlimit_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
|
||||
|
||||
alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100;
|
||||
execute 'alter database regression with IS_TEMPLATE false CONNECTION LIMIT' || v_connlimit_initial;
|
||||
|
||||
alter database regression with IS_TEMPLATE true;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
|
||||
alter database regression with IS_TEMPLATE false;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
end;
|
||||
$$
|
||||
language plpgsql;
|
||||
NOTICE: v_connlimit: -1, v_connlimit_fetched: 100
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
||||
NOTICE: v_connlimit: -1, v_connlimit_fetched: -1
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
||||
alter database regression with IS_TEMPLATE true;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
datistemplate
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
alter database regression with IS_TEMPLATE false;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
datistemplate
|
||||
---------------------------------------------------------------------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
v_version_num int;
|
||||
BEGIN
|
||||
SELECT current_setting('server_version_num')::numeric INTO v_version_num;
|
||||
IF v_version_num >= 150000 THEN
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
execute 'alter database regression REFRESH COLLATION VERSION';
|
||||
set citus.log_remote_commands = false;
|
||||
ELSE
|
||||
RAISE NOTICE 'Skipping alter database .. REFRESH COLLATION VERSION for PostgreSQL version < 15.';
|
||||
END IF;
|
||||
END;
|
||||
$$
|
||||
language plpgsql;
|
||||
NOTICE: version has not changed
|
||||
CONTEXT: SQL statement "alter database regression REFRESH COLLATION VERSION"
|
||||
PL/pgSQL function inline_code_block line XX at EXECUTE
|
||||
NOTICE: issuing ALTER DATABASE regression REFRESH COLLATION VERSION;
|
||||
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression REFRESH COLLATION VERSION"
|
||||
PL/pgSQL function inline_code_block line XX at EXECUTE
|
||||
NOTICE: issuing ALTER DATABASE regression REFRESH COLLATION VERSION;
|
||||
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT 100"
|
||||
PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression REFRESH COLLATION VERSION"
|
||||
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT 100"
|
||||
PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
NOTICE: v_connlimit_initial: -1, v_connlimit_fetched: 100
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
||||
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT -1"
|
||||
PL/pgSQL function inline_code_block line XX at EXECUTE
|
||||
NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with CONNECTION LIMIT -1"
|
||||
PL/pgSQL function inline_code_block line XX at EXECUTE
|
||||
NOTICE: v_connlimit_initial: -1, v_connlimit_fetched: -1
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
||||
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true' CONNECTION LIMIT 100;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100"
|
||||
PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true' CONNECTION LIMIT 100;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100"
|
||||
PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
NOTICE: issuing ALTER DATABASE regression WITH is_template 'false' CONNECTION LIMIT -1;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE false CONNECTION LIMIT-1"
|
||||
PL/pgSQL function inline_code_block line XX at EXECUTE
|
||||
NOTICE: issuing ALTER DATABASE regression WITH is_template 'false' CONNECTION LIMIT -1;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE false CONNECTION LIMIT-1"
|
||||
PL/pgSQL function inline_code_block line XX at EXECUTE
|
||||
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true';
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true"
|
||||
PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
NOTICE: issuing ALTER DATABASE regression WITH is_template 'true';
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
CONTEXT: SQL statement "alter database regression with IS_TEMPLATE true"
|
||||
PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
ERROR: query has no destination for result data
|
||||
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at SQL statement
|
||||
set citus.log_remote_commands = false;
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--since ALLOW_CONNECTIONS alter option should be executed in a different database
|
||||
-- and since we don't have a multiple database support for now,
|
||||
-- this statement will get error
|
||||
alter database regression ALLOW_CONNECTIONS false;
|
||||
ERROR: ALLOW_CONNECTIONS is not supported
|
||||
DO $$
|
||||
declare
|
||||
v_connlimit numeric;
|
||||
v_connlimit_fetched int;
|
||||
begin
|
||||
select datconnlimit into v_connlimit from pg_database where datname = 'regression';
|
||||
alter database regression with CONNECTION LIMIT 100;
|
||||
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
|
||||
raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched;
|
||||
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit;
|
||||
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
|
||||
raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched;
|
||||
end;
|
||||
$$
|
||||
language plpgsql;
|
||||
NOTICE: v_connlimit: -1, v_connlimit_fetched: 100
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
||||
NOTICE: v_connlimit: -1, v_connlimit_fetched: -1
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
||||
alter database regression with IS_TEMPLATE true;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
datistemplate
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
alter database regression with IS_TEMPLATE false;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
datistemplate
|
||||
---------------------------------------------------------------------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
v_version_num int;
|
||||
BEGIN
|
||||
SELECT current_setting('server_version_num')::numeric INTO v_version_num;
|
||||
IF v_version_num >= 150000 THEN
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
execute 'alter database regression REFRESH COLLATION VERSION';
|
||||
set citus.log_remote_commands = false;
|
||||
ELSE
|
||||
RAISE NOTICE 'Skipping alter database .. REFRESH COLLATION VERSION for PostgreSQL version < 15.';
|
||||
END IF;
|
||||
END;
|
||||
$$
|
||||
language plpgsql;
|
||||
NOTICE: Skipping alter database .. REFRESH COLLATION VERSION for PostgreSQL version < 15.
|
||||
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
|
|
@ -1,3 +1,6 @@
|
|||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
|
||||
--since ALLOW_CONNECTIONS alter option should be executed in a different database
|
||||
-- and since we don't have a multiple database support for now,
|
||||
-- this statement will get error
|
||||
|
@ -6,41 +9,28 @@ alter database regression ALLOW_CONNECTIONS false;
|
|||
|
||||
DO $$
|
||||
declare
|
||||
v_connlimit numeric;
|
||||
v_connlimit_initial numeric;
|
||||
v_connlimit_fetched int;
|
||||
begin
|
||||
select datconnlimit into v_connlimit from pg_database where datname = 'regression';
|
||||
select datconnlimit into v_connlimit_initial from pg_database where datname = 'regression';
|
||||
alter database regression with CONNECTION LIMIT 100;
|
||||
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
|
||||
raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched;
|
||||
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit;
|
||||
raise notice 'v_connlimit_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
|
||||
execute 'alter database regression with CONNECTION LIMIT ' || v_connlimit_initial;
|
||||
select datconnlimit into v_connlimit_fetched from pg_database where datname = 'regression';
|
||||
raise notice 'v_connlimit: %, v_connlimit_fetched: %', v_connlimit, v_connlimit_fetched;
|
||||
raise notice 'v_connlimit_initial: %, v_connlimit_fetched: %', v_connlimit_initial, v_connlimit_fetched;
|
||||
|
||||
alter database regression with IS_TEMPLATE true CONNECTION LIMIT 100;
|
||||
execute 'alter database regression with IS_TEMPLATE false CONNECTION LIMIT' || v_connlimit_initial;
|
||||
|
||||
alter database regression with IS_TEMPLATE true;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
|
||||
alter database regression with IS_TEMPLATE false;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
end;
|
||||
$$
|
||||
language plpgsql;
|
||||
|
||||
|
||||
alter database regression with IS_TEMPLATE true;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
|
||||
alter database regression with IS_TEMPLATE false;
|
||||
select datistemplate from pg_database where datname = 'regression';
|
||||
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
v_version_num int;
|
||||
BEGIN
|
||||
SELECT current_setting('server_version_num')::numeric INTO v_version_num;
|
||||
IF v_version_num >= 150000 THEN
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
execute 'alter database regression REFRESH COLLATION VERSION';
|
||||
set citus.log_remote_commands = false;
|
||||
ELSE
|
||||
RAISE NOTICE 'Skipping alter database .. REFRESH COLLATION VERSION for PostgreSQL version < 15.';
|
||||
END IF;
|
||||
END;
|
||||
$$
|
||||
language plpgsql;
|
||||
set citus.log_remote_commands = false;
|
||||
|
|
|
@ -965,6 +965,11 @@ SELECT (groupid = 0) AS is_coordinator, result FROM run_command_on_all_nodes(
|
|||
JOIN pg_dist_node USING (nodeid)
|
||||
ORDER BY is_coordinator DESC, result;
|
||||
|
||||
set citus.log_remote_commands = true;
|
||||
set citus.grep_remote_commands = '%ALTER DATABASE%';
|
||||
alter database regression REFRESH COLLATION VERSION;
|
||||
set citus.log_remote_commands = false;
|
||||
|
||||
-- Clean up
|
||||
\set VERBOSITY terse
|
||||
SET client_min_messages TO ERROR;
|
||||
|
|
Loading…
Reference in New Issue