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

Commit93becb4

Browse files
committed
Fix mess in MtmGucSet()
1 parent52d3545 commit93becb4

File tree

1 file changed

+26
-41
lines changed

1 file changed

+26
-41
lines changed

‎multimaster.c‎

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

36003600
staticHTAB*MtmGucHash=NULL;
3601+
staticList*MtmGucList=NULL;
36013602

36023603
staticvoidMtmGucHashInit(void)
36033604
{
@@ -3618,7 +3619,6 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
36183619
MemoryContextoldcontext;
36193620
MtmGucHashEntry*hentry;
36203621
boolfound;
3621-
char*key;
36223622

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

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

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

36723648
caseVAR_RESET_ALL:
3673-
{
3674-
hash_destroy(MtmGucHash);
3675-
MtmGucHashInit();
3676-
}
3649+
/* XXX: shouldn't we keep auth/role here? */
3650+
hash_destroy(MtmGucHash);
3651+
MtmGucHashInit();
36773652
break;
36783653

3654+
caseVAR_SET_CURRENT:
36793655
caseVAR_SET_MULTI:
36803656
break;
36813657
}
@@ -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