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

Commit1120b99

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
The session_replication_role actually can be changed at will during
a session regardless of the existence of cached plans. The plancacheonly needs to be invalidated so that rules affected by the new settingwill be reflected in the new query plans.Jan
1 parentf744262 commit1120b99

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

‎src/backend/utils/cache/plancache.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Portions Copyright (c) 1994, Regents of the University of California
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.9 2007/05/14 18:13:21 tgl Exp $
36+
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.10 2007/06/05 20:00:41 wieck Exp $
3737
*
3838
*-------------------------------------------------------------------------
3939
*/
@@ -944,14 +944,3 @@ InvalRelid(Oid relid, LOCKMODE lockmode, InvalRelidContext *context)
944944
if (relid==context->inval_relid||context->inval_relid==InvalidOid)
945945
context->plan->dead= true;
946946
}
947-
948-
949-
/*
950-
* HaveCachedPlans
951-
*Check if the plancache has stored any plans at all.
952-
*/
953-
bool
954-
HaveCachedPlans(void)
955-
{
956-
return (cached_plans_list!=NIL);
957-
}

‎src/backend/utils/misc/guc.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.393 2007/06/03 17:07:34 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.394 2007/06/05 20:00:41 wieck Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -6270,24 +6270,29 @@ assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
62706270
staticconstchar*
62716271
assign_session_replication_role(constchar*newval,booldoit,GucSourcesource)
62726272
{
6273-
if (HaveCachedPlans())
6274-
elog(ERROR,"session_replication_role cannot be changed "
6275-
"after prepared plans have been cached");
6276-
62776273
if (pg_strcasecmp(newval,"origin")==0)
62786274
{
62796275
if (doit)
6276+
{
6277+
ResetPlanCache();
62806278
SessionReplicationRole=SESSION_REPLICATION_ROLE_ORIGIN;
6279+
}
62816280
}
62826281
elseif (pg_strcasecmp(newval,"replica")==0)
62836282
{
62846283
if (doit)
6284+
{
6285+
ResetPlanCache();
62856286
SessionReplicationRole=SESSION_REPLICATION_ROLE_REPLICA;
6287+
}
62866288
}
62876289
elseif (pg_strcasecmp(newval,"local")==0)
62886290
{
62896291
if (doit)
6292+
{
6293+
ResetPlanCache();
62906294
SessionReplicationRole=SESSION_REPLICATION_ROLE_LOCAL;
6295+
}
62916296
}
62926297
else
62936298
returnNULL;

‎src/include/utils/plancache.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/utils/plancache.h,v 1.6 2007/04/16 18:21:07 tgl Exp $
11+
* $PostgreSQL: pgsql/src/include/utils/plancache.h,v 1.7 2007/06/05 20:00:41 wieck Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -106,7 +106,6 @@ extern CachedPlan *RevalidateCachedPlan(CachedPlanSource *plansource,
106106
booluseResOwner);
107107
externvoidReleaseCachedPlan(CachedPlan*plan,booluseResOwner);
108108
externTupleDescPlanCacheComputeResultDesc(List*stmt_list);
109-
externboolHaveCachedPlans(void);
110109

111110
externvoidResetPlanCache(void);
112111

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp