mirror of https://github.com/citusdata/citus.git
Escape transaction names
parent
9fb897a074
commit
e8ecbbfcb3
|
@ -236,8 +236,8 @@ StartRemoteTransactionCommit(MultiConnection *connection)
|
||||||
StringInfoData command;
|
StringInfoData command;
|
||||||
|
|
||||||
initStringInfo(&command);
|
initStringInfo(&command);
|
||||||
appendStringInfo(&command, "COMMIT PREPARED '%s'",
|
appendStringInfo(&command, "COMMIT PREPARED %s",
|
||||||
transaction->preparedName);
|
quote_literal_cstr(transaction->preparedName));
|
||||||
|
|
||||||
transaction->transactionState = REMOTE_TRANS_2PC_COMMITTING;
|
transaction->transactionState = REMOTE_TRANS_2PC_COMMITTING;
|
||||||
|
|
||||||
|
@ -371,8 +371,8 @@ StartRemoteTransactionAbort(MultiConnection *connection)
|
||||||
ForgetResults(connection);
|
ForgetResults(connection);
|
||||||
|
|
||||||
initStringInfo(&command);
|
initStringInfo(&command);
|
||||||
appendStringInfo(&command, "ROLLBACK PREPARED '%s'",
|
appendStringInfo(&command, "ROLLBACK PREPARED %s",
|
||||||
transaction->preparedName);
|
quote_literal_cstr(transaction->preparedName));
|
||||||
|
|
||||||
if (!SendRemoteCommand(connection, command.data))
|
if (!SendRemoteCommand(connection, command.data))
|
||||||
{
|
{
|
||||||
|
@ -497,8 +497,8 @@ StartRemoteTransactionPrepare(struct MultiConnection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
initStringInfo(&command);
|
initStringInfo(&command);
|
||||||
appendStringInfo(&command, "PREPARE TRANSACTION '%s'",
|
appendStringInfo(&command, "PREPARE TRANSACTION %s",
|
||||||
transaction->preparedName);
|
quote_literal_cstr(transaction->preparedName));
|
||||||
|
|
||||||
if (!SendRemoteCommand(connection, command.data))
|
if (!SendRemoteCommand(connection, command.data))
|
||||||
{
|
{
|
||||||
|
@ -1314,8 +1314,6 @@ CheckRemoteTransactionsHealth(void)
|
||||||
* The connection number is used to distinguish connections made to a node
|
* The connection number is used to distinguish connections made to a node
|
||||||
* within the same transaction.
|
* within the same transaction.
|
||||||
*
|
*
|
||||||
* NB: we rely on the fact that we don't need to do full escaping on the names
|
|
||||||
* generated here.
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Assign2PCIdentifier(MultiConnection *connection)
|
Assign2PCIdentifier(MultiConnection *connection)
|
||||||
|
@ -1431,13 +1429,13 @@ WarnAboutLeakedPreparedTransaction(MultiConnection *connection, bool commit)
|
||||||
|
|
||||||
if (commit)
|
if (commit)
|
||||||
{
|
{
|
||||||
appendStringInfo(&command, "COMMIT PREPARED '%s'",
|
appendStringInfo(&command, "COMMIT PREPARED %s",
|
||||||
transaction->preparedName);
|
quote_literal_cstr(transaction->preparedName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendStringInfo(&command, "ROLLBACK PREPARED '%s'",
|
appendStringInfo(&command, "ROLLBACK PREPARED %s",
|
||||||
transaction->preparedName);
|
quote_literal_cstr(transaction->preparedName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* log a warning so the user may abort the transaction later */
|
/* log a warning so the user may abort the transaction later */
|
||||||
|
|
|
@ -499,12 +499,14 @@ RecoverPreparedTransactionOnWorker(MultiConnection *connection, char *transactio
|
||||||
if (shouldCommit)
|
if (shouldCommit)
|
||||||
{
|
{
|
||||||
/* should have committed this prepared transaction */
|
/* should have committed this prepared transaction */
|
||||||
appendStringInfo(command, "COMMIT PREPARED '%s'", transactionName);
|
appendStringInfo(command, "COMMIT PREPARED %s",
|
||||||
|
quote_literal_cstr(transactionName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* should have aborted this prepared transaction */
|
/* should have aborted this prepared transaction */
|
||||||
appendStringInfo(command, "ROLLBACK PREPARED '%s'", transactionName);
|
appendStringInfo(command, "ROLLBACK PREPARED %s",
|
||||||
|
quote_literal_cstr(transactionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
executeCommand = ExecuteOptionalRemoteCommand(connection, command->data, &result);
|
executeCommand = ExecuteOptionalRemoteCommand(connection, command->data, &result);
|
||||||
|
|
Loading…
Reference in New Issue