Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:39 AM
Zdenek Kotala
 
Posts: n/a
Default Allow commenting of variables in postgresql.conf to restore them todefaults

There is path implements following item from todo list: "Allow
commenting of variables in postgresql.conf to restore them to defaults".
Main idea is:

General config structure is extend with default_val attribute to keep
really default value. (There is small conflict - for string boot_val has same meaning).
During reconfiguration all values which has reset source equal with
PGC_S_FILE are revert back to really default values. New values from
configuration files are set after this step and commented variables stay
with default value.

Zdenek



Index: src/backend/utils/misc/guc-file.l

================================================== =================

RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v

retrieving revision 1.37

diff -r1.37 guc-file.l

115c115

< int elevel;

---

> int elevel, i;


116a117

> char *env;


145a147,182

> /* Revert all options with reset source PGC_S_FILE to default value.


> * This implementation is easier then implementing some change flag and verify


> * what really was commented out.


> * XXX When log_line_prefix is set in configuration file then log output


> * is not correct during this phase - prefix is revert to empty value.


> */


> for (i = 0; i < num_guc_variables; i++)


> {


> struct config_generic *gconf = guc_variables[i];


> if ( gconf->reset_source == PGC_S_FILE )


> {


> set_config_option(gconf->name, NULL, context,


> PGC_S_FILE, false, true);


> }


> }


>


> /* Revert to environment variable. PGPORT is ignored, because it cannot be


> * set in running state. PGC_S_FILE is used instead PGC_S_ENV so as


> * set_config_option can override previous defined option in config file.


> * If these options are still in config file They will be overridden in


> * the following step.


> */


> env = getenv("PGDATESTYLE");


> if (env != NULL)


> {


> set_config_option("datestyle", env, context,


> PGC_S_FILE, false, true);


> }


>


> env = getenv("PGCLIENTENCODING");


> if (env != NULL)


> {


> set_config_option("client_encoding", env, context,


> PGC_S_FILE, false, true);


> }


>


Index: src/backend/utils/misc/guc.c

================================================== =================

RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v

retrieving revision 1.319

diff -r1.319 guc.c

2651c2651

< if (!(*conf->assign_hook) (conf->reset_val, true,

---

> if (!(*conf->assign_hook) (conf->default_val, true,


2654,2655c2654,2655

< conf->gen.name, (int) conf->reset_val);

< *conf->variable = conf->reset_val;

---

> conf->gen.name, (int) conf->default_val);


> *conf->variable = conf->reset_val = conf->default_val;


2665c2665

< if (!(*conf->assign_hook) (conf->reset_val, true,

---

> if (!(*conf->assign_hook) (conf->default_val, true,


2668,2669c2668,2669

< conf->gen.name, conf->reset_val);

< *conf->variable = conf->reset_val;

---

> conf->gen.name, conf->default_val);


> *conf->variable = conf->reset_val = conf->default_val;


2679c2679

< if (!(*conf->assign_hook) (conf->reset_val, true,

---

> if (!(*conf->assign_hook) (conf->default_val, true,


2682,2683c2682,2683

< conf->gen.name, conf->reset_val);

< *conf->variable = conf->reset_val;

---

> conf->gen.name, conf->default_val);


> *conf->variable = conf->reset_val = conf->default_val;


3650c3650

< if (changeVal && !is_newvalue_equal(record, value))

---

> if (changeVal && value != NULL && !is_newvalue_equal(record, value))


3726c3726

< makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value != NULL);

---

> makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value != NULL || source == PGC_S_FILE);


3769,3770c3769,3781

< newval = conf->reset_val;

< source = conf->gen.reset_source;

---

> /* Revert value to default if source is configuration file. It is used when


> * configuration parameter is removed/commented out in the config file. Else


> * RESET or SET TO DEFAULT command is called and reset_val is used.


> */


> if( source == PGC_S_FILE )


> {


> newval = conf->default_val;


> }


> else


> {


> newval = conf->reset_val;


> source = conf->gen.reset_source;


> }


3853,3854c3864,3876

< newval = conf->reset_val;

< source = conf->gen.reset_source;

---

> /* Revert value to default if source is configuration file. It is used when


> * configuration parameter is removed/commented out in the config file. Else


> * RESET or SET TO DEFAULT command is called and reset_val is used.


> */


> if( source == PGC_S_FILE )


> {


> newval = conf->default_val;


> }


> else


> {


> newval = conf->reset_val;


> source = conf->gen.reset_source;


> }


3937,3938c3959,3971

< newval = conf->reset_val;

< source = conf->gen.reset_source;

---

> /* Revert value to default if source is configuration file. It is used when


> * configuration parameter is removed/commented out in the config file. Else


> * RESET or SET TO DEFAULT command is called and reset_val is used.


> */


> if( source == PGC_S_FILE )


> {


> newval = conf->default_val;


> }


> else


> {


> newval = conf->reset_val;


> source = conf->gen.reset_source;


> }


4011a4045,4058

> else if (source == PGC_S_FILE)


> {


> /* Revert value to default when item is removed from config file. */


> if ( conf->boot_val != NULL )


> {


> newval = guc_strdup(elevel, conf->boot_val);


> if (newval == NULL)


> return false;


> }


> else


> {


> return false;


> }


> }


5113a5161,5165

> if( !newvalue )


> {


> return false;


> }


>


Index: src/include/utils/guc_tables.h

================================================== =================

RCS file: /projects/cvsroot/pgsql/src/include/utils/guc_tables.h,v

retrieving revision 1.22

diff -r1.22 guc_tables.h

145c145

< bool reset_val;

---

> bool default_val;


149a150

> bool reset_val;


158c159

< int reset_val;

---

> int default_val;


164a166

> int reset_val;


173c175

< double reset_val;

---

> double default_val;


179a182,183

> double reset_val;


>







---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:39 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to

Zdenek Kotala wrote:
> There is path implements following item from todo list: "Allow
> commenting of variables in postgresql.conf to restore them to defaults".
> Main idea is:
>
> General config structure is extend with default_val attribute to keep
> really default value. (There is small conflict - for string boot_val
> has same meaning).
> During reconfiguration all values which has reset source equal with
> PGC_S_FILE are revert back to really default values. New values from
> configuration files are set after this step and commented variables
> stay with default value.
>


Please resubmit your patch as a context diff, as documented here:
http://www.postgresql.org/docs/faqs....V.html#item1.5

cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 12:39 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to

Andrew Dunstan wrote:
> Zdenek Kotala wrote:
>> There is path implements following item from todo list: "Allow
>> commenting of variables in postgresql.conf to restore them to defaults".
>> Main idea is:
>>
>> General config structure is extend with default_val attribute to keep
>> really default value. (There is small conflict - for string boot_val
>> has same meaning).
>> During reconfiguration all values which has reset source equal with
>> PGC_S_FILE are revert back to really default values. New values from
>> configuration files are set after this step and commented variables
>> stay with default value.
>>

>
> Please resubmit your patch as a context diff, as documented here:
> http://www.postgresql.org/docs/faqs....V.html#item1.5
>
> cheers
>
> andrew

I am sorry. Here it is:



Index: src/backend/utils/misc/guc-file.l
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v
retrieving revision 1.37
diff -c -r1.37 guc-file.l
*** src/backend/utils/misc/guc-file.l 7 Mar 2006 01:03:12 -0000 1.37
--- src/backend/utils/misc/guc-file.l 24 May 2006 14:10:12 -0000
***************
*** 112,119 ****
void
ProcessConfigFile(GucContext context)
{
! int elevel;
struct name_value_pair *item, *head, *tail;

Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);

--- 112,120 ----
void
ProcessConfigFile(GucContext context)
{
! int elevel, i;
struct name_value_pair *item, *head, *tail;
+ char *env;

Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);

***************
*** 143,148 ****
--- 144,185 ----
goto cleanup_list;
}

+ /* Revert all options with reset source PGC_S_FILE to default value.
+ * This implementation is easier then iplementing some change flag
and verify
+ * what realy was commented out.
+ * XXX When log_line_prefix is set in configuration file then log
output
+ * is not correct during this phase - prefix is revert to empty value.
+ */
+ for (i = 0; i < num_guc_variables; i++)
+ {
+ struct config_generic *gconf = guc_variables[i];
+ if ( gconf->reset_source == PGC_S_FILE )
+ {
+ set_config_option(gconf->name, NULL, context,
+ PGC_S_FILE, false, true);
+ }
+ }
+
+ /* Revert to environment variable. PGPORT is ignored, because it
cannot be
+ * set in running state. PGC_S_FILE is used instead PGC_S_ENV so as
+ * set_config_option can override previous defined option in
config file.
+ * If these options are still in config file They will be
overriden in
+ * the following step.
+ */
+ env = getenv("PGDATESTYLE");
+ if (env != NULL)
+ {
+ set_config_option("datestyle", env, context,
+ PGC_S_FILE, false, true);
+ }
+
+ env = getenv("PGCLIENTENCODING");
+ if (env != NULL)
+ {
+ set_config_option("client_encoding", env, context,
+ PGC_S_FILE, false, true);
+ }
+
/* If we got here all the options checked out okay, so apply them. */
for (item = head; item; item = item->next)
{
Index: src/backend/utils/misc/guc.c
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.319
diff -c -r1.319 guc.c
*** src/backend/utils/misc/guc.c 11 May 2006 19:15:35 -0000 1.319
--- src/backend/utils/misc/guc.c 24 May 2006 14:10:12 -0000
***************
*** 2648,2658 ****
struct config_bool *conf = (struct config_bool *)
gconf;

if (conf->assign_hook)
! if (!(*conf->assign_hook) (conf->reset_val, true,
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %d",
! conf->gen.name, (int) conf->reset_val);
! *conf->variable = conf->reset_val;
break;
}
case PGC_INT:
--- 2648,2658 ----
struct config_bool *conf = (struct config_bool *)
gconf;

if (conf->assign_hook)
! if (!(*conf->assign_hook) (conf->default_val,
true,
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %d",
! conf->gen.name, (int) conf->default_val);
! *conf->variable = conf->reset_val = conf->default_val;
break;
}
case PGC_INT:
***************
*** 2662,2672 ****
Assert(conf->reset_val >= conf->min);
Assert(conf->reset_val <= conf->max);
if (conf->assign_hook)
! if (!(*conf->assign_hook) (conf->reset_val, true,
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %d",
! conf->gen.name, conf->reset_val);
! *conf->variable = conf->reset_val;
break;
}
case PGC_REAL:
--- 2662,2672 ----
Assert(conf->reset_val >= conf->min);
Assert(conf->reset_val <= conf->max);
if (conf->assign_hook)
! if (!(*conf->assign_hook) (conf->default_val,
true,
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %d",
! conf->gen.name, conf->default_val);
! *conf->variable = conf->reset_val =
conf->default_val;
break;
}
case PGC_REAL:
***************
*** 2676,2686 ****
Assert(conf->reset_val >= conf->min);
Assert(conf->reset_val <= conf->max);
if (conf->assign_hook)
! if (!(*conf->assign_hook) (conf->reset_val, true,
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %g",
! conf->gen.name, conf->reset_val);
! *conf->variable = conf->reset_val;
break;
}
case PGC_STRING:
--- 2676,2686 ----
Assert(conf->reset_val >= conf->min);
Assert(conf->reset_val <= conf->max);
if (conf->assign_hook)
! if (!(*conf->assign_hook) (conf->default_val,
true,
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %g",
! conf->gen.name, conf->default_val);
! *conf->variable = conf->reset_val =
conf->default_val;
break;
}
case PGC_STRING:
***************
*** 3647,3653 ****
case PGC_POSTMASTER:
if (context == PGC_SIGHUP)
{
! if (changeVal && !is_newvalue_equal(record, value))
ereport(elevel,
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
errmsg("parameter \"%s\" cannot be
changed after server start; configuration file change ignored",
--- 3647,3653 ----
case PGC_POSTMASTER:
if (context == PGC_SIGHUP)
{
! if (changeVal && value != NULL &&
!is_newvalue_equal(record, value))
ereport(elevel,
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
errmsg("parameter \"%s\" cannot be
changed after server start; configuration file change ignored",
***************
*** 3723,3729 ****
* Should we set reset/stacked values? (If so, the behavior is not
* transactional.)
*/
! makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value !=
NULL);

/*
* Ignore attempted set if overridden by previously processed setting.
--- 3723,3729 ----
* Should we set reset/stacked values? (If so, the behavior is not
* transactional.)
*/
! makeDefault = changeVal && (source <= PGC_S_OVERRIDE) && (value !=
NULL || source == PGC_S_FILE);

/*
* Ignore attempted set if overridden by previously processed setting.
***************
*** 3766,3773 ****
}
else
{
! newval = conf->reset_val;
! source = conf->gen.reset_source;
}

if (conf->assign_hook)
--- 3766,3784 ----
}
else
{
! /* Revert value to default if source is
configuration file. It is used when
! * configuration parameter is removed/commented
out in the config file. Else
! * RESET or SET TO DEFAULT command is called and
reset_val is used.
! */
! if( source == PGC_S_FILE )
! {
! newval = conf->default_val;
! }
! else
! {
! newval = conf->reset_val;
! source = conf->gen.reset_source;
! }
}

if (conf->assign_hook)
***************
*** 3850,3857 ****
}
else
{
! newval = conf->reset_val;
! source = conf->gen.reset_source;
}

if (conf->assign_hook)
--- 3861,3879 ----
}
else
{
! /* Revert value to default if source is
configuration file. It is used when
! * configuration parameter is removed/commented
out in the config file. Else
! * RESET or SET TO DEFAULT command is called and
reset_val is used.
! */
! if( source == PGC_S_FILE )
! {
! newval = conf->default_val;
! }
! else
! {
! newval = conf->reset_val;
! source = conf->gen.reset_source;
! }
}

if (conf->assign_hook)
***************
*** 3934,3941 ****
}
else
{
! newval = conf->reset_val;
! source = conf->gen.reset_source;
}

if (conf->assign_hook)
--- 3956,3974 ----
}
else
{
! /* Revert value to default if source is
configuration file. It is used when
! * configuration parameter is removed/commented
out in the config file. Else
! * RESET or SET TO DEFAULT command is called and
reset_val is used.
! */
! if( source == PGC_S_FILE )
! {
! newval = conf->default_val;
! }
! else
! {
! newval = conf->reset_val;
! source = conf->gen.reset_source;
! }
}

if (conf->assign_hook)
***************
*** 4009,4014 ****
--- 4042,4061 ----
if (conf->gen.flags & GUC_IS_NAME)
truncate_identifier(newval, strlen(newval), true);
}
+ else if (source == PGC_S_FILE)
+ {
+ /* Revert value to default when item is removed
from config file. */
+ if ( conf->boot_val != NULL )
+ {
+ newval = guc_strdup(elevel, conf->boot_val);
+ if (newval == NULL)
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
else if (conf->reset_val)
{
/*
***************
*** 5111,5116 ****
--- 5158,5168 ----
static bool
is_newvalue_equal(struct config_generic *record, const char *newvalue)
{
+ if( !newvalue )
+ {
+ return false;
+ }
+
switch (record->vartype)
{
case PGC_BOOL:
Index: src/include/utils/guc_tables.h
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/include/utils/guc_tables.h,v
retrieving revision 1.22
diff -c -r1.22 guc_tables.h
*** src/include/utils/guc_tables.h 5 Mar 2006 15:59:07 -0000 1.22
--- src/include/utils/guc_tables.h 24 May 2006 14:10:13 -0000
***************
*** 142,152 ****
/* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */
bool *variable;
! bool reset_val;
GucBoolAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
bool tentative_val;
};

struct config_int
--- 142,153 ----
/* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */
bool *variable;
! bool default_val;
GucBoolAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
bool tentative_val;
+ bool reset_val;
};

struct config_int
***************
*** 155,167 ****
/* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */
int *variable;
! int reset_val;
int min;
int max;
GucIntAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
int tentative_val;
};

struct config_real
--- 156,169 ----
/* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */
int *variable;
! int default_val;
int min;
int max;
GucIntAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
int tentative_val;
+ int reset_val;
};

struct config_real
***************
*** 170,182 ****
/* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */
double *variable;
! double reset_val;
double min;
double max;
GucRealAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
double tentative_val;
};

struct config_string
--- 172,186 ----
/* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */
double *variable;
! double default_val;
double min;
double max;
GucRealAssignHook assign_hook;
GucShowHook show_hook;
/* variable fields, initialized at runtime: */
double tentative_val;
+ double reset_val;
+
};

struct config_string


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 12:39 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to

Zdenek Kotala wrote:
> Andrew Dunstan wrote:
> >Zdenek Kotala wrote:
> >>There is path implements following item from todo list: "Allow
> >>commenting of variables in postgresql.conf to restore them to defaults".
> >>Main idea is:
> >>
> >>General config structure is extend with default_val attribute to keep
> >>really default value. (There is small conflict - for string boot_val
> >>has same meaning).
> >>During reconfiguration all values which has reset source equal with
> >>PGC_S_FILE are revert back to really default values. New values from
> >>configuration files are set after this step and commented variables
> >>stay with default value.
> >>

> >
> >Please resubmit your patch as a context diff, as documented here:
> >http://www.postgresql.org/docs/faqs....V.html#item1.5


> I am sorry. Here it is:


Please resubmit as an attachment, or disallow your mail client from
munging whitespace ... I see wrapped words here, and apparently tab
expansion as well.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-18-2008, 12:39 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to

Alvaro Herrera wrote:
> Zdenek Kotala wrote:
>
>>> Zdenek Kotala wrote:
>>>
>>>> There is path implements following item from todo list: "Allow
>>>> commenting of variables in postgresql.conf to restore them to defaults".
>>>> Main idea is:
>>>>
>>>> General config structure is extend with default_val attribute to keep
>>>> really default value. (There is small conflict - for string boot_val
>>>> has same meaning).
>>>> During reconfiguration all values which has reset source equal with
>>>> PGC_S_FILE are revert back to really default values. New values from
>>>> configuration files are set after this step and commented variables
>>>> stay with default value.
>>>>
>>>>
>>>

>
> Please resubmit as an attachment, or disallow your mail client from
> munging whitespace ... I see wrapped words here, and apparently tab
> expansion as well.
>
>

OK. Here is patch like attachment.

Zdenek


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 12:39 AM
Joachim Wieland
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to

Zdenek,

On Wed, May 24, 2006 at 04:27:01PM +0200, Zdenek Kotala wrote:
> >>>>General config structure is extend with default_val attribute to keep
> >>>>really default value. (There is small conflict - for string boot_val
> >>>>has same meaning).
> >>>>During reconfiguration all values which has reset source equal with
> >>>>PGC_S_FILE are revert back to really default values. New values from
> >>>>configuration files are set after this step and commented variables
> >>>>stay with default value.


Three points after a quick test:

- please compile with --enable-cassert, there are wrong assertions in your
code (you might just have to move some lines, there is an Assert() and an
assignment thereafter)

- changing a PGC_POSTMASTER should show a message:
=> parameter \"%s\" cannot be changed after server start;
configuration file change ignored
This seems to not show up anymore with your patch.

- with the same reasoning, I think it's a good idea to display a message
about which option falls back to its default value.


Joachim


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-18-2008, 12:39 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to

Joachim,

thanks for your comments. I am working on them.

Zdenek

Joachim Wieland wrote:
> Zdenek,
>
> Three points after a quick test:
>
> - please compile with --enable-cassert, there are wrong assertions in your
> code (you might just have to move some lines, there is an Assert() and an
> assignment thereafter)
>
> - changing a PGC_POSTMASTER should show a message:
> => parameter \"%s\" cannot be changed after server start;
> configuration file change ignored
> This seems to not show up anymore with your patch.
>
> - with the same reasoning, I think it's a good idea to display a message
> about which option falls back to its default value.
>
>
> Joachim
>
>



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-18-2008, 12:41 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to -

There is second version of patch. I made following changes:

- fix problem with assertion
- use boot_val instead default_val for all configuration data types
- add GUC_JUST_RELOAD status to track what is in configuration file or not
- revert only commented out variables
- add message what is revert to boot value

Joachim, could you explain me second point? I cannot determine
described problem. By my opinion my patch does not change this behavior.

Zdenek

Joachim Wieland wrote:
> Zdenek,
>
> Three points after a quick test:
>
> - please compile with --enable-cassert, there are wrong assertions in your
> code (you might just have to move some lines, there is an Assert() and an
> assignment thereafter)
>
> - changing a PGC_POSTMASTER should show a message:
> => parameter \"%s\" cannot be changed after server start;
> configuration file change ignored
> This seems to not show up anymore with your patch.
>
> - with the same reasoning, I think it's a good idea to display a message
> about which option falls back to its default value.
>
>
> Joachim
>
>




---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-18-2008, 12:41 AM
Joachim Wieland
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to - try2

Zdenek,

On Wed, May 31, 2006 at 06:13:04PM +0200, Zdenek Kotala wrote:
> Joachim, could you explain me second point? I cannot determine
> described problem. By my opinion my patch does not change this behavior.


I guess what I saw was another phenomenon:

I do the following:

- vi postgresql.conf => "allow_system_table_mods = true"
- start postmaster
- vi postgresql.conf => "# allow_system_table_mods = true" (commented)
- killall -HUP postmaster

Then I get _no_ message. After another killall -HUP I do indeed get a
message. So I don't get it just for the first time which is strange, do you
see that as well?

However the message I get is that it got reset to its default value which is
wrong because its a PGC_POSTMASTER variable that can only be set at server
start (set_config_option() returns true in this case as well).

Consequently I expect to get it for every other signal I send (because the
old value is still active and differs from what is in the configuration
file).


Joachim


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-18-2008, 12:41 AM
Zdenek Kotala
 
Posts: n/a
Default Re: Allow commenting of variables in postgresql.conf to -

Thanks, You have right. It is problem with silent skip some option in
set_config_option function when PGC_SIGHUP is running context.

I fix it and I attach third version of patch.

Zdenek



Joachim Wieland wrote:
> Zdenek,
>
> On Wed, May 31, 2006 at 06:13:04PM +0200, Zdenek Kotala wrote:
>
>> Joachim, could you explain me second point? I cannot determine
>> described problem. By my opinion my patch does not change this behavior.
>>

>
> I guess what I saw was another phenomenon:
>
> I do the following:
>
> - vi postgresql.conf => "allow_system_table_mods = true"
> - start postmaster
> - vi postgresql.conf => "# allow_system_table_mods = true" (commented)
> - killall -HUP postmaster
>
> Then I get _no_ message. After another killall -HUP I do indeed get a
> message. So I don't get it just for the first time which is strange, do you
> see that as well?
>
> However the message I get is that it got reset to its default value which is
> wrong because its a PGC_POSTMASTER variable that can only be set at server
> start (set_config_option() returns true in this case as well).
>
> Consequently I expect to get it for every other signal I send (because the
> old value is still active and differs from what is in the configuration
> file).
>
>
> Joachim
>
>




---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:43 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96<