@@ -156,7 +156,7 @@ static void MtmShmemStartup(void);
156
156
static BgwPool * MtmPoolConstructor (void );
157
157
static bool MtmRunUtilityStmt (PGconn * conn , char const * sql , char * * errmsg );
158
158
static void MtmBroadcastUtilityStmt (char const * sql , bool ignoreError );
159
- static bool MtmProcessDDLCommand (char const * queryString , bool transactional );
159
+ static void MtmProcessDDLCommand (char const * queryString , bool transactional );
160
160
161
161
MtmState * Mtm ;
162
162
@@ -175,7 +175,8 @@ static MtmConnectionInfo* MtmConnections;
175
175
static MtmCurrentTrans MtmTx ;
176
176
static dlist_head MtmLsnMapping = DLIST_STATIC_INIT (MtmLsnMapping );
177
177
178
- static TransactionManager MtmTM = {
178
+ static TransactionManager MtmTM =
179
+ {
179
180
PgTransactionIdGetStatus ,
180
181
PgTransactionIdSetTreeStatus ,
181
182
MtmGetSnapshot ,
@@ -4431,18 +4432,29 @@ char* MtmGucSerialize(void)
4431
4432
* -------------------------------------------
4432
4433
*/
4433
4434
4434
- static bool MtmProcessDDLCommand (char const * queryString , bool transactional )
4435
+ static void MtmProcessDDLCommand (char const * queryString , bool transactional )
4435
4436
{
4437
+ char * gucCtx = MtmGucSerialize ();
4438
+ if (* gucCtx ) {
4439
+ queryString = psprintf ("RESET SESSION AUTHORIZATION; reset all; %s; %s" , gucCtx , queryString );
4440
+ } else {
4441
+ queryString = psprintf ("RESET SESSION AUTHORIZATION; reset all; %s" , queryString );
4442
+ }
4436
4443
MTM_LOG3 ("Sending utility: %s" , queryString );
4437
4444
if (transactional ) {
4438
4445
/* DDL */
4439
4446
LogLogicalMessage ("D" , queryString , strlen (queryString ) + 1 , true);
4440
4447
MtmTx .containsDML = true;
4441
- } else {
4448
+ } else {
4449
+ char * gucCtx = MtmGucSerialize ();
4450
+ return ;
4451
+ if (* gucCtx ) {
4452
+ queryString = psprintf ("%s; %s" , gucCtx , queryString );
4453
+ }
4442
4454
/* CONCURRENT DDL */
4443
4455
XLogFlush (LogLogicalMessage ("C" , queryString , strlen (queryString ) + 1 , false));
4444
4456
}
4445
- return false ;
4457
+ return ;
4446
4458
}
4447
4459
4448
4460
static void MtmFinishDDLCommand ()
@@ -4530,16 +4542,18 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4530
4542
4531
4543
case T_VacuumStmt :
4532
4544
skipCommand = true;
4533
- // if (context == PROCESS_UTILITY_TOPLEVEL) {
4534
- // MtmProcessDDLCommand(queryString, false, true);
4535
- // MtmTx.isDistributed = false;
4536
- // } else if (MtmApplyContext != NULL) {
4537
- // MemoryContext oldContext = MemoryContextSwitchTo(MtmApplyContext);
4538
- // Assert(oldContext != MtmApplyContext);
4539
- // MtmVacuumStmt = (VacuumStmt*)copyObject(parsetree);
4540
- // MemoryContextSwitchTo(oldContext);
4541
- // return;
4542
- // }
4545
+ #if 0
4546
+ if (context == PROCESS_UTILITY_TOPLEVEL ) {
4547
+ MtmProcessDDLCommand (queryString , false);
4548
+ MtmTx .isDistributed = false;
4549
+ } else if (MtmApplyContext != NULL ) {
4550
+ MemoryContext oldContext = MemoryContextSwitchTo (MtmApplyContext );
4551
+ Assert (oldContext != MtmApplyContext );
4552
+ MtmVacuumStmt = (VacuumStmt * )copyObject (parsetree );
4553
+ MemoryContextSwitchTo (oldContext );
4554
+ return ;
4555
+ }
4556
+ #endif
4543
4557
break ;
4544
4558
4545
4559
case T_CreateDomainStmt :
@@ -4634,7 +4648,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4634
4648
if (indexStmt -> concurrent )
4635
4649
{
4636
4650
if (context == PROCESS_UTILITY_TOPLEVEL ) {
4637
- // MtmProcessDDLCommand(queryString, false, true );
4651
+ MtmProcessDDLCommand (queryString , false);
4638
4652
MtmTx .isDistributed = false;
4639
4653
skipCommand = true;
4640
4654
/*
@@ -4661,7 +4675,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4661
4675
if (stmt -> removeType == OBJECT_INDEX && stmt -> concurrent )
4662
4676
{
4663
4677
if (context == PROCESS_UTILITY_TOPLEVEL ) {
4664
- // MtmProcessDDLCommand(queryString, false, true );
4678
+ MtmProcessDDLCommand (queryString , false);
4665
4679
MtmTx .isDistributed = false;
4666
4680
skipCommand = true;
4667
4681
} else if (MtmApplyContext != NULL ) {
0 commit comments