Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit869aefc

Browse files
committed
Fix mess in MtmGucSet()
1 parent05af1db commit869aefc

File tree

1 file changed

+26
-41
lines changed

1 file changed

+26
-41
lines changed

‎contrib/mmts/multimaster.c‎

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,6 +3599,7 @@ typedef struct MtmGucHashEntry
35993599
}MtmGucHashEntry;
36003600

36013601
staticHTAB*MtmGucHash=NULL;
3602+
staticList*MtmGucList=NULL;
36023603

36033604
staticvoidMtmGucHashInit(void)
36043605
{
@@ -3619,7 +3620,6 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
36193620
MemoryContextoldcontext;
36203621
MtmGucHashEntry*hentry;
36213622
boolfound;
3622-
char*key;
36233623

36243624
if (!MtmGucHash)
36253625
MtmGucHashInit();
@@ -3629,54 +3629,30 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
36293629
switch (stmt->kind)
36303630
{
36313631
caseVAR_SET_VALUE:
3632-
caseVAR_SET_DEFAULT:
3633-
caseVAR_SET_CURRENT:
3634-
{
3635-
char*value;
3636-
3637-
key=pstrdup(stmt->name);
3638-
hash_search(MtmGucHash,key,HASH_FIND,&found);
3639-
value=ExtractSetVariableArgs(stmt);
3640-
3641-
fprintf(stderr,":MtmGucSet: %s -> %s\n",key,value);
3642-
3643-
if (value)
3644-
{
3645-
hentry= (MtmGucHashEntry*)hash_search(MtmGucHash,key,
3646-
HASH_ENTER,&found);
3647-
3648-
// if (found)
3649-
// pfree(hentry->value);
3632+
hentry= (MtmGucHashEntry*)hash_search(MtmGucHash,stmt->name,
3633+
HASH_ENTER,&found);
3634+
if (found)
3635+
pfree(hentry->value);
3636+
hentry->value=ExtractSetVariableArgs(stmt);
3637+
break;
36503638

3651-
hentry->value=palloc(strlen(value)+1);
3652-
strcpy(hentry->value,value);
3653-
}
3654-
elseif (found)
3655-
{
3656-
/* That was SET TO DEFAULT and we already had some value */
3657-
hash_search(MtmGucHash,key,HASH_REMOVE,NULL);
3658-
}
3659-
}
3639+
caseVAR_SET_DEFAULT:
3640+
hash_search(MtmGucHash,stmt->name,HASH_REMOVE,NULL);
36603641
break;
36613642

36623643
caseVAR_RESET:
3663-
{
3664-
if (strcmp(stmt->name,"session_authorization")==0)
3665-
{
3666-
hash_search(MtmGucHash,"role",HASH_REMOVE,NULL);
3667-
}
3668-
key=pstrdup(stmt->name);
3669-
hash_search(MtmGucHash,key,HASH_REMOVE,NULL);
3670-
}
3644+
if (strcmp(stmt->name,"session_authorization")==0)
3645+
hash_search(MtmGucHash,"role",HASH_REMOVE,NULL);
3646+
hash_search(MtmGucHash,stmt->name,HASH_REMOVE,NULL);
36713647
break;
36723648

36733649
caseVAR_RESET_ALL:
3674-
{
3675-
hash_destroy(MtmGucHash);
3676-
MtmGucHashInit();
3677-
}
3650+
/* XXX: shouldn't we keep auth/role here? */
3651+
hash_destroy(MtmGucHash);
3652+
MtmGucHashInit();
36783653
break;
36793654

3655+
caseVAR_SET_CURRENT:
36803656
caseVAR_SET_MULTI:
36813657
break;
36823658
}
@@ -4000,10 +3976,19 @@ MtmExecutorStart(QueryDesc *queryDesc, int eflags)
40003976
TargetEntry*tle= (TargetEntry*)lfirst(tlist);
40013977

40023978
if (tle->resname&&strcmp(tle->resname,"lo_create")==0)
3979+
{
40033980
ddl_generating_call= true;
3981+
break;
3982+
}
3983+
3984+
if (tle->resname&&strcmp(tle->resname,"lo_unlink")==0)
3985+
{
3986+
ddl_generating_call= true;
3987+
break;
3988+
}
40043989
}
40053990

4006-
if (ddl_generating_call)
3991+
if (ddl_generating_call&& !MtmTx.isReplicated)
40073992
MtmProcessDDLCommand(ActivePortal->sourceText, true);
40083993

40093994
if (PreviousExecutorStartHook!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp