Unix Technical Forum

Server does not start when log_statement_stats is set to on

This is a discussion on Server does not start when log_statement_stats is set to on within the pgsql Bugs forums, part of the PostgreSQL category; --> Hi, I'm getting this error when I set lot_statement_stats to on : FATAL: invalid value for parameter "log_statement_stats": 1 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 11:13 AM
Devrim =?ISO-8859-1?Q?G=DCND=DCZ?=
 
Posts: n/a
Default Server does not start when log_statement_stats is set to on

Hi,

I'm getting this error when I set lot_statement_stats to on :

FATAL: invalid value for parameter "log_statement_stats": 1

and server does not start. This is "almost" default configuration file
(8.2.5, Fedora 8, running on my laptop):

http://www.gunduz.org/tmp/postgresql.conf

Per Alexey (and Alvaro), both log_planner_stats and log_statement_stats
cannot be turned on at the same time. Is that documented somewhere, or
can we please improve the error message here -- or is it a bug?

Thoughts?

Regards,
--
Devrim GÜNDÜZ , RHCE
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHco9bpme12CBXnxERAnxPAJ0aekQiEbeY65OYkvQ4Io AhXY83JQCfX5AV
OTASXYIWbmj4tSicqghtNNY=
=NEQt
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 11:13 AM
Tom Lane
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is set to on

Devrim =?ISO-8859-1?Q?G=DCND=DCZ?= <devrim@CommandPrompt.com> writes:
> I'm getting this error when I set lot_statement_stats to on :
> FATAL: invalid value for parameter "log_statement_stats": 1


> Per Alexey (and Alvaro), both log_planner_stats and log_statement_stats
> cannot be turned on at the same time.


Yup:

regression=# set log_planner_stats TO 1;
SET
regression=# set log_statement_stats TO 1;
ERROR: cannot enable "log_statement_stats" when "log_parser_stats", "log_planner_stats", or "log_executor_stats" is true

> Is that documented somewhere,


Yes.

> or can we please improve the error message here -- or is it a bug?


It's not a bug. However, the specific error message only comes out in
interactive-SET cases:

if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot enable \"log_statement_stats\" when "
"\"log_parser_stats\", \"log_planner_stats\", "
"or \"log_executor_stats\" is true")));

There are a bunch of other GUC assign hooks that behave similarly.
Perhaps it'd be sensible to emit these complaints as LOG messages
when we're dealing with a noninteractive source (ie, the config file)?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 11:13 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is setto on

Tom Lane wrote:
> Devrim =?ISO-8859-1?Q?G=DCND=DCZ?= <devrim@CommandPrompt.com> writes:


> > or can we please improve the error message here -- or is it a bug?

>
> It's not a bug. However, the specific error message only comes out in
> interactive-SET cases:
>
> if (source >= PGC_S_INTERACTIVE)
> ereport(ERROR,
> (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> errmsg("cannot enable \"log_statement_stats\" when "
> "\"log_parser_stats\", \"log_planner_stats\", "
> "or \"log_executor_stats\" is true")));
>
> There are a bunch of other GUC assign hooks that behave similarly.
> Perhaps it'd be sensible to emit these complaints as LOG messages
> when we're dealing with a noninteractive source (ie, the config file)?


I was wondering whether we could make this error message (and
equivalent ones) be the FATAL one that prevents the server from
starting.

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

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 11:13 AM
Tom Lane
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is set to on

Alvaro Herrera <alvherre@CommandPrompt.com> writes:
> Tom Lane wrote:
>> There are a bunch of other GUC assign hooks that behave similarly.
>> Perhaps it'd be sensible to emit these complaints as LOG messages
>> when we're dealing with a noninteractive source (ie, the config file)?


> I was wondering whether we could make this error message (and
> equivalent ones) be the FATAL one that prevents the server from
> starting.


There is some good reason, which I don't recall at the moment, why
assign-hooks (and most of the rest of GUC) shouldn't FATAL in the
middle of processing a config file. However a LOG seems relatively
harmless, and better than not emitting anything.

regards, tom lane

---------------------------(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
  #5 (permalink)  
Old 04-10-2008, 11:13 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is setto on

Tom Lane wrote:
> Alvaro Herrera <alvherre@CommandPrompt.com> writes:
> > Tom Lane wrote:
> >> There are a bunch of other GUC assign hooks that behave similarly.
> >> Perhaps it'd be sensible to emit these complaints as LOG messages
> >> when we're dealing with a noninteractive source (ie, the config file)?

>
> > I was wondering whether we could make this error message (and
> > equivalent ones) be the FATAL one that prevents the server from
> > starting.

>
> There is some good reason, which I don't recall at the moment, why
> assign-hooks (and most of the rest of GUC) shouldn't FATAL in the
> middle of processing a config file. However a LOG seems relatively
> harmless, and better than not emitting anything.


I'm thinking of keeping the ERROR, which (I think) would cause
postmaster to treat it as FATAL because there is no error handler set up
yet (no, I haven't tried it).

Perhaps you are correct in that LOG is the path of least resistance ...

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

---------------------------(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
  #6 (permalink)  
Old 04-10-2008, 11:13 AM
Tom Lane
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is set to on

Alvaro Herrera <alvherre@CommandPrompt.com> writes:
> Tom Lane wrote:
>> There is some good reason, which I don't recall at the moment, why
>> assign-hooks (and most of the rest of GUC) shouldn't FATAL in the
>> middle of processing a config file.


> I'm thinking of keeping the ERROR, which (I think) would cause
> postmaster to treat it as FATAL because there is no error handler set up
> yet (no, I haven't tried it).


Yeah, it would, and that is the wrong thing.

It is definitely not acceptable to throw an ERROR unconditionally,
as that would cause postmaster abort during SIGHUP if an error is
introduced into the config file after startup. It's possible that
we could add some state by which assign-hook routines could check
whether this is initial startup or not, but then we'd still have
the issue of whether there are any other reasons not to throw ERROR
just there (I have a feeling there are some internal-to-GUC reasons
why not, as well as the obvious one that SIGHUP shouldn't be able
to crash the postmaster).

The whole idea sounds pretty shaky to me, and definitely not
something to change in late beta. LOG we could do now without
risking breaking anything.

regards, tom lane

---------------------------(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
  #7 (permalink)  
Old 04-10-2008, 11:13 AM
Tom Lane
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is set to on

I wrote:
> The whole idea sounds pretty shaky to me, and definitely not
> something to change in late beta. LOG we could do now without
> risking breaking anything.


Poking around a bit more, I notice that there are already some places
that do it the way I was thinking of, eg in commands/variable.c:

if (!new_tz)
{
ereport((source >= PGC_S_INTERACTIVE) ? ERROR : LOG,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized time zone name: \"%s\"",
value)));
return NULL;
}

However, even this is not really good enough: in the event of a wrong
entry inserted into postgresql.conf, this coding will result in every
extant backend emitting the same LOG message at SIGHUP. That's
annoying. The right way to do it is as illustrated in
set_config_option(): only the postmaster should log at LOG level,
everyone else should be down around DEBUG2 (if not lower).

That's getting to be a bit complicated to replicate in N places, though.
Plus if we ever want to make it work like Alvaro is thinking of, we'd
have to go back and change all those places again. So I propose
inventing a function

int guc_complaint_level(GucSource source)

that encapsulates this logic. The correct coding for specialized
error messages in assign-hook routines would then be like

if (!new_tz)
{
ereport(guc_complaint_level(source),
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized time zone name: \"%s\"",
value)));
return NULL;
}

giving us only one place to change to alter this logic.

Comments, objections?

regards, tom lane

---------------------------(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
  #8 (permalink)  
Old 04-10-2008, 11:13 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is setto on

Tom Lane wrote:

> That's getting to be a bit complicated to replicate in N places, though.
> Plus if we ever want to make it work like Alvaro is thinking of, we'd
> have to go back and change all those places again. So I propose
> inventing a function
>
> int guc_complaint_level(GucSource source)
>
> that encapsulates this logic.


I think this makes plenty of sense. However, something that occured to
me just now is that perhaps the right thing to do in the long term is to
put this message in errcontext and leave the "invalid value for XXX" as
the main error message. That would probably involve attaching a
errcontext callback and removing the complaint_level from this message
altogether, letting the outer caller deal with it. I'm not sure how
would GUC work if the assign hook did not raise an ERROR in the
interactive case though.

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

---------------------------(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
  #9 (permalink)  
Old 04-10-2008, 11:13 AM
Tom Lane
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is set to on

Alvaro Herrera <alvherre@CommandPrompt.com> writes:
> I think this makes plenty of sense. However, something that occured to
> me just now is that perhaps the right thing to do in the long term is to
> put this message in errcontext and leave the "invalid value for XXX" as
> the main error message. That would probably involve attaching a
> errcontext callback and removing the complaint_level from this message
> altogether, letting the outer caller deal with it.


errcontext wouldn't help --- by the time guc.c is ready to throw the
error, the assign hook isn't in the call stack anymore. We'd have to
invent some other special-purpose gizmo to make this work.

Might be worth doing, but again, seems too big a change for 8.3.

regards, tom lane

---------------------------(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
  #10 (permalink)  
Old 04-10-2008, 11:13 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Server does not start when log_statement_stats is setto on

Tom Lane wrote:
> Alvaro Herrera <alvherre@CommandPrompt.com> writes:
> > I think this makes plenty of sense. However, something that occured to
> > me just now is that perhaps the right thing to do in the long term is to
> > put this message in errcontext and leave the "invalid value for XXX" as
> > the main error message. That would probably involve attaching a
> > errcontext callback and removing the complaint_level from this message
> > altogether, letting the outer caller deal with it.

>
> errcontext wouldn't help --- by the time guc.c is ready to throw the
> error, the assign hook isn't in the call stack anymore. We'd have to
> invent some other special-purpose gizmo to make this work.
>
> Might be worth doing, but again, seems too big a change for 8.3.


Right -- your proposed fix seems fine for 8.3.

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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

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 12:52 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526