mirror of https://github.com/citusdata/citus.git
Fix incorrect "VALID UNTIL" assumption made for roles in node activation (#7534)
Fixes https://github.com/citusdata/citus/issues/7533. DESCRIPTION: Fixes incorrect `VALID UNTIL` setting assumption made for roles when syncing them to new nodespull/7841/head
parent
89ccafff50
commit
ef946e44af
|
@ -491,18 +491,17 @@ GenerateRoleOptionsList(HeapTuple tuple)
|
|||
options = lappend(options, makeDefElem("password", NULL, -1));
|
||||
}
|
||||
|
||||
/* load valid unitl data from the heap tuple, use default of infinity if not set */
|
||||
/* load valid until data from the heap tuple */
|
||||
Datum rolValidUntilDatum = SysCacheGetAttr(AUTHNAME, tuple,
|
||||
Anum_pg_authid_rolvaliduntil, &isNull);
|
||||
char *rolValidUntil = "infinity";
|
||||
if (!isNull)
|
||||
{
|
||||
rolValidUntil = pstrdup((char *) timestamptz_to_str(rolValidUntilDatum));
|
||||
}
|
||||
char *rolValidUntil = pstrdup((char *) timestamptz_to_str(rolValidUntilDatum));
|
||||
|
||||
Node *validUntilStringNode = (Node *) makeString(rolValidUntil);
|
||||
DefElem *validUntilOption = makeDefElem("validUntil", validUntilStringNode, -1);
|
||||
options = lappend(options, validUntilOption);
|
||||
Node *validUntilStringNode = (Node *) makeString(rolValidUntil);
|
||||
DefElem *validUntilOption = makeDefElem("validUntil", validUntilStringNode, -1);
|
||||
options = lappend(options, validUntilOption);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
|
|
@ -129,17 +129,17 @@ SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
|||
SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, (rolpassword != '') as pass_not_empty, rolvaliduntil FROM pg_authid WHERE rolname LIKE 'create\_%' ORDER BY rolname;
|
||||
rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | pass_not_empty | rolvaliduntil
|
||||
---------------------------------------------------------------------
|
||||
create_group | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_group_2 | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_role | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_role"edge | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_role'edge | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_role_2 | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_role_sysid | f | t | f | f | f | f | f | -1 | | infinity
|
||||
create_group | f | t | f | f | f | f | f | -1 | |
|
||||
create_group_2 | f | t | f | f | f | f | f | -1 | |
|
||||
create_role | f | t | f | f | f | f | f | -1 | |
|
||||
create_role"edge | f | t | f | f | f | f | f | -1 | |
|
||||
create_role'edge | f | t | f | f | f | f | f | -1 | |
|
||||
create_role_2 | f | t | f | f | f | f | f | -1 | |
|
||||
create_role_sysid | f | t | f | f | f | f | f | -1 | |
|
||||
create_role_with_everything | t | t | t | t | t | t | t | 105 | t | Thu May 04 17:00:00 2045 PDT
|
||||
create_role_with_nothing | f | f | f | f | f | f | f | 3 | t | Mon May 04 17:00:00 2015 PDT
|
||||
create_user | f | t | f | f | t | f | f | -1 | | infinity
|
||||
create_user_2 | f | t | f | f | t | f | f | -1 | | infinity
|
||||
create_user | f | t | f | f | t | f | f | -1 | |
|
||||
create_user_2 | f | t | f | f | t | f | f | -1 | |
|
||||
(11 rows)
|
||||
|
||||
SELECT roleid::regrole::text AS role, member::regrole::text, grantor::regrole::text, admin_option FROM pg_auth_members WHERE roleid::regrole::text LIKE 'create\_%' ORDER BY 1, 2;
|
||||
|
|
|
@ -67,6 +67,20 @@ SELECT 1 FROM run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|||
1
|
||||
(2 rows)
|
||||
|
||||
-- In the version that we use for upgrade tests (v10.2.0), we propagate
|
||||
-- "valid until" to the workers as "infinity" even if it's not set. And
|
||||
-- given that "postgres" role is created in the older version, "valid until"
|
||||
-- is set to "infinity" on the workers while this is not the case for
|
||||
-- coordinator. See https://github.com/citusdata/citus/issues/7533.
|
||||
--
|
||||
-- We're fixing this for new versions of Citus and we'll probably backport
|
||||
-- this to some older versions too. However, v10.2.0 won't ever have this
|
||||
-- fix.
|
||||
--
|
||||
-- For this reason, here we set "valid until" to "infinity" for all the
|
||||
-- nodes so that below query doesn't report any difference between the
|
||||
-- metadata on coordinator and workers.
|
||||
ALTER ROLE postgres WITH VALID UNTIL 'infinity';
|
||||
-- make sure that the metadata is consistent across all nodes
|
||||
-- we exclude the distributed_object_data as they are
|
||||
-- not sorted in the same order (as OIDs differ on the nodes)
|
||||
|
|
|
@ -27,6 +27,21 @@ SET datestyle = "ISO, YMD";
|
|||
SELECT 1 FROM run_command_on_workers($$ALTER SYSTEM SET datestyle = "ISO, YMD";$$);
|
||||
SELECT 1 FROM run_command_on_workers($$SELECT pg_reload_conf()$$);
|
||||
|
||||
-- In the version that we use for upgrade tests (v10.2.0), we propagate
|
||||
-- "valid until" to the workers as "infinity" even if it's not set. And
|
||||
-- given that "postgres" role is created in the older version, "valid until"
|
||||
-- is set to "infinity" on the workers while this is not the case for
|
||||
-- coordinator. See https://github.com/citusdata/citus/issues/7533.
|
||||
--
|
||||
-- We're fixing this for new versions of Citus and we'll probably backport
|
||||
-- this to some older versions too. However, v10.2.0 won't ever have this
|
||||
-- fix.
|
||||
--
|
||||
-- For this reason, here we set "valid until" to "infinity" for all the
|
||||
-- nodes so that below query doesn't report any difference between the
|
||||
-- metadata on coordinator and workers.
|
||||
ALTER ROLE postgres WITH VALID UNTIL 'infinity';
|
||||
|
||||
-- make sure that the metadata is consistent across all nodes
|
||||
-- we exclude the distributed_object_data as they are
|
||||
-- not sorted in the same order (as OIDs differ on the nodes)
|
||||
|
|
Loading…
Reference in New Issue