Skip to content

Commit fdbeae3

Browse files
committed
Detect and replicate lo_create() calls
1 parent 10b4690 commit fdbeae3

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

contrib/mmts/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,
@@ -2675,6 +2677,9 @@ _PG_init(void)
26752677
PreviousShmemStartupHook = shmem_startup_hook;
26762678
shmem_startup_hook = MtmShmemStartup;
26772679

2680+
PreviousExecutorStartHook = ExecutorStart_hook;
2681+
ExecutorStart_hook = MtmExecutorStart;
2682+
26782683
PreviousExecutorFinishHook = ExecutorFinish_hook;
26792684
ExecutorFinish_hook = MtmExecutorFinish;
26802685

@@ -3973,12 +3978,34 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39733978
MtmTx.snapshot = INVALID_CSN;
39743979
}
39753980

3976-
if (executed && !skipCommand)
3981+
if (executed)
39773982
{
39783983
MtmFinishDDLCommand();
39793984
}
39803985
}
39813986

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

39834010
static void
39844011
MtmExecutorFinish(QueryDesc *queryDesc)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy