@@ -164,6 +164,7 @@ MtmState* Mtm;
164
164
VacuumStmt * MtmVacuumStmt ;
165
165
IndexStmt * MtmIndexStmt ;
166
166
DropStmt * MtmDropStmt ;
167
+ void * MtmTablespaceStmt ; /* CREATE/DELETE tablespace */
167
168
MemoryContext MtmApplyContext ;
168
169
169
170
HTAB * MtmXid2State ;
@@ -4636,7 +4637,7 @@ char* MtmGucSerialize(void)
4636
4637
appendStringInfoString (serialized_gucs , " TO " );
4637
4638
4638
4639
/* quite a crutch */
4639
- if (strstr (cur_entry -> key , "_mem" ) != NULL )
4640
+ if (strstr (cur_entry -> key , "_mem" ) != NULL || * ( cur_entry -> value ) == '\0' )
4640
4641
{
4641
4642
appendStringInfoString (serialized_gucs , "'" );
4642
4643
appendStringInfoString (serialized_gucs , cur_entry -> value );
@@ -4661,20 +4662,26 @@ char* MtmGucSerialize(void)
4661
4662
4662
4663
static void MtmProcessDDLCommand (char const * queryString , bool transactional )
4663
4664
{
4664
- char * gucCtx = MtmGucSerialize ();
4665
- if (* gucCtx ) {
4666
- queryString = psprintf ("RESET SESSION AUTHORIZATION; reset all; %s; %s" , gucCtx , queryString );
4667
- } else {
4668
- queryString = psprintf ("RESET SESSION AUTHORIZATION; reset all; %s" , queryString );
4669
- }
4670
- MTM_LOG3 ("Sending utility: %s" , queryString );
4671
- if (transactional ) {
4665
+ if (MtmTx .isReplicated )
4666
+ return ;
4667
+
4668
+ if (transactional )
4669
+ {
4670
+ char * gucCtx = MtmGucSerialize ();
4671
+ if (* gucCtx )
4672
+ queryString = psprintf ("RESET SESSION AUTHORIZATION; reset all; %s; %s" , gucCtx , queryString );
4673
+ else
4674
+ queryString = psprintf ("RESET SESSION AUTHORIZATION; reset all; %s" , queryString );
4675
+
4672
4676
/* Transactional DDL */
4677
+ MTM_LOG3 ("Sending DDL: %s" , queryString );
4673
4678
LogLogicalMessage ("D" , queryString , strlen (queryString ) + 1 , true);
4674
4679
MtmTx .containsDML = true;
4675
- } else {
4676
- MTM_LOG1 ("Execute concurrent DDL: %s" , queryString );
4680
+ }
4681
+ else
4682
+ {
4677
4683
/* Concurrent DDL */
4684
+ MTM_LOG1 ("Sending concurrent DDL: %s" , queryString );
4678
4685
XLogFlush (LogLogicalMessage ("C" , queryString , strlen (queryString ) + 1 , false));
4679
4686
}
4680
4687
}
@@ -4748,8 +4755,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4748
4755
case T_ClosePortalStmt :
4749
4756
case T_FetchStmt :
4750
4757
case T_DoStmt :
4751
- case T_CreateTableSpaceStmt :
4752
- case T_AlterTableSpaceOptionsStmt :
4753
4758
case T_CommentStmt :
4754
4759
case T_PrepareStmt :
4755
4760
case T_ExecuteStmt :
@@ -4761,13 +4766,32 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
4761
4766
case T_ClusterStmt :
4762
4767
case T_VariableShowStmt :
4763
4768
case T_ReassignOwnedStmt :
4764
- case T_LockStmt :
4769
+ case T_LockStmt : // XXX: check whether we should replicate that
4765
4770
case T_CheckPointStmt :
4766
4771
case T_ReindexStmt :
4767
4772
case T_ExplainStmt :
4768
4773
skipCommand = true;
4769
4774
break ;
4770
4775
4776
+ case T_CreateTableSpaceStmt :
4777
+ case T_DropTableSpaceStmt :
4778
+ {
4779
+ if (MtmApplyContext != NULL )
4780
+ {
4781
+ MemoryContext oldContext = MemoryContextSwitchTo (MtmApplyContext );
4782
+ Assert (oldContext != MtmApplyContext );
4783
+ MtmTablespaceStmt = copyObject (parsetree );
4784
+ MemoryContextSwitchTo (oldContext );
4785
+ return ;
4786
+ }
4787
+ else
4788
+ {
4789
+ skipCommand = true;
4790
+ MtmProcessDDLCommand (queryString , false);
4791
+ }
4792
+ }
4793
+ break ;
4794
+
4771
4795
case T_VacuumStmt :
4772
4796
skipCommand = true;
4773
4797
if (context == PROCESS_UTILITY_TOPLEVEL ) {
0 commit comments