Commit 7dab4f75 authored by Tom Lane's avatar Tom Lane

Minor editorialization: don't flush plan cache without need.

parent 31edbadf
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.394 2007/06/05 20:00:41 wieck Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.395 2007/06/05 21:50:19 tgl Exp $
* *
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
...@@ -6270,32 +6270,27 @@ assign_defaultxactisolevel(const char *newval, bool doit, GucSource source) ...@@ -6270,32 +6270,27 @@ assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
static const char * static const char *
assign_session_replication_role(const char *newval, bool doit, GucSource source) assign_session_replication_role(const char *newval, bool doit, GucSource source)
{ {
int newrole;
if (pg_strcasecmp(newval, "origin") == 0) if (pg_strcasecmp(newval, "origin") == 0)
{ newrole = SESSION_REPLICATION_ROLE_ORIGIN;
if (doit)
{
ResetPlanCache();
SessionReplicationRole = SESSION_REPLICATION_ROLE_ORIGIN;
}
}
else if (pg_strcasecmp(newval, "replica") == 0) else if (pg_strcasecmp(newval, "replica") == 0)
{ newrole = SESSION_REPLICATION_ROLE_REPLICA;
if (doit)
{
ResetPlanCache();
SessionReplicationRole = SESSION_REPLICATION_ROLE_REPLICA;
}
}
else if (pg_strcasecmp(newval, "local") == 0) else if (pg_strcasecmp(newval, "local") == 0)
{ newrole = SESSION_REPLICATION_ROLE_LOCAL;
if (doit)
{
ResetPlanCache();
SessionReplicationRole = SESSION_REPLICATION_ROLE_LOCAL;
}
}
else else
return NULL; return NULL;
/*
* Must flush the plan cache when changing replication role; but don't
* flush unnecessarily.
*/
if (doit && SessionReplicationRole != newrole)
{
ResetPlanCache();
SessionReplicationRole = newrole;
}
return newval; return newval;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment