Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0252391

Browse files
committed
Detect and replicate lo_create() calls
1 parent f22016c commit 0252391

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

multimaster.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,14 @@ static int MtmGcPeriod;
229229
static bool MtmIgnoreTablesWithoutPk;
230230
static int MtmLockCount;
231231

232+
static ExecutorStart_hook_type PreviousExecutorStartHook;
232233
static ExecutorFinish_hook_type PreviousExecutorFinishHook;
233234
static ProcessUtility_hook_type PreviousProcessUtilityHook;
234235
static shmem_startup_hook_type PreviousShmemStartupHook;
235236

236237
static nodemask_t lastKnownMatrix[MAX_NODES];
237238

239+
static void MtmExecutorStart(QueryDesc *queryDesc, int eflags);
238240
static void MtmExecutorFinish(QueryDesc *queryDesc);
239241
static void MtmProcessUtility(Node *parsetree, const char *queryString,
240242
ProcessUtilityContext context, ParamListInfo params,
@@ -2681,6 +2683,9 @@ _PG_init(void)
26812683
PreviousShmemStartupHook = shmem_startup_hook;
26822684
shmem_startup_hook = MtmShmemStartup;
26832685

2686+
PreviousExecutorStartHook = ExecutorStart_hook;
2687+
ExecutorStart_hook = MtmExecutorStart;
2688+
26842689
PreviousExecutorFinishHook = ExecutorFinish_hook;
26852690
ExecutorFinish_hook = MtmExecutorFinish;
26862691

@@ -3978,12 +3983,34 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39783983
MtmTx.snapshot = INVALID_CSN;
39793984
}
39803985

3981-
if (executed && !skipCommand)
3986+
if (executed)
39823987
{
39833988
MtmFinishDDLCommand();
39843989
}
39853990
}
39863991

3992+
static void
3993+
MtmExecutorStart(QueryDesc *queryDesc, int eflags)
3994+
{
3995+
bool ddl_generating_call = false;
3996+
ListCell *tlist;
3997+
3998+
foreach(tlist, queryDesc->plannedstmt->planTree->targetlist)
3999+
{
4000+
TargetEntry *tle = (TargetEntry *) lfirst(tlist);
4001+
4002+
if (tle->resname && strcmp(tle->resname, "lo_create") == 0)
4003+
ddl_generating_call = true;
4004+
}
4005+
4006+
if (ddl_generating_call)
4007+
MtmProcessDDLCommand(ActivePortal->sourceText, true);
4008+
4009+
if (PreviousExecutorStartHook != NULL)
4010+
PreviousExecutorStartHook(queryDesc, eflags);
4011+
else
4012+
standard_ExecutorStart(queryDesc, eflags);
4013+
}
39874014

39884015
static void
39894016
MtmExecutorFinish(QueryDesc *queryDesc)

0 commit comments

Comments
 (0)