Fixing failures

reuse-connections-for-logical-ref-fkeys-niupre
Nitish Upreti 2022-09-15 17:27:23 -07:00
parent dce396fc3d
commit 2fec99d7b0
2 changed files with 16 additions and 9 deletions

View File

@ -1211,8 +1211,10 @@ CreateUncheckedForeignKeyConstraints(List *logicalRepTargetList)
list_make1("SET LOCAL citus.skip_constraint_validation TO ON;"), list_make1("SET LOCAL citus.skip_constraint_validation TO ON;"),
commandList); commandList);
SendCommandListToWorkerOutsideTransactionWithConnection( SendCommandListToWorkerOutsideTransaction(
target->superuserConnection, target->superuserConnection->hostname,
target->superuserConnection->port,
target->superuserConnection->user,
commandList); commandList);
MemoryContextReset(localContext); MemoryContextReset(localContext);
@ -1591,8 +1593,8 @@ DropUser(MultiConnection *connection, char *username)
* The DROP USER command should not propagate, so we temporarily disable * The DROP USER command should not propagate, so we temporarily disable
* DDL propagation. * DDL propagation.
*/ */
SendCommandListToWorkerOutsideTransactionWithConnection( SendCommandListToWorkerOutsideTransaction(
connection, connection->hostname, connection->port, connection->user,
list_make2( list_make2(
"SET LOCAL citus.enable_ddl_propagation TO OFF;", "SET LOCAL citus.enable_ddl_propagation TO OFF;",
psprintf("DROP USER IF EXISTS %s", psprintf("DROP USER IF EXISTS %s",
@ -1777,8 +1779,10 @@ CreateSubscriptions(MultiConnection *sourceConnection,
* create a user with SUPERUSER permissions and then alter it to NOSUPERUSER. * create a user with SUPERUSER permissions and then alter it to NOSUPERUSER.
* This prevents permission escalations. * This prevents permission escalations.
*/ */
SendCommandListToWorkerOutsideTransactionWithConnection( SendCommandListToWorkerOutsideTransaction(
target->superuserConnection, target->superuserConnection->hostname,
target->superuserConnection->port,
target->superuserConnection->user,
list_make2( list_make2(
"SET LOCAL citus.enable_ddl_propagation TO OFF;", "SET LOCAL citus.enable_ddl_propagation TO OFF;",
psprintf( psprintf(
@ -1836,8 +1840,10 @@ CreateSubscriptions(MultiConnection *sourceConnection,
* The ALTER ROLE command should not propagate, so we temporarily * The ALTER ROLE command should not propagate, so we temporarily
* disable DDL propagation. * disable DDL propagation.
*/ */
SendCommandListToWorkerOutsideTransactionWithConnection( SendCommandListToWorkerOutsideTransaction(
target->superuserConnection, target->superuserConnection->hostname,
target->superuserConnection->port,
target->superuserConnection->user,
list_make2( list_make2(
"SET LOCAL citus.enable_ddl_propagation TO OFF;", "SET LOCAL citus.enable_ddl_propagation TO OFF;",
psprintf( psprintf(

View File

@ -803,7 +803,8 @@ CoordinatedRemoteTransactionsPrepare(void)
iter.cur); iter.cur);
RemoteTransaction *transaction = &connection->remoteTransaction; RemoteTransaction *transaction = &connection->remoteTransaction;
Assert(transaction->transactionState != REMOTE_TRANS_NOT_STARTED); // This is not true as we call ResetConnection() on InProgressTransactions
// Assert(transaction->transactionState != REMOTE_TRANS_NOT_STARTED);
/* can't PREPARE a transaction that failed */ /* can't PREPARE a transaction that failed */
if (transaction->transactionFailed) if (transaction->transactionFailed)