- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitc76db55
committed
Split pgstat_bestart() into three different routines
pgstat_bestart(), used post-authentication to set up a backend entryin the PgBackendStatus array, so as its data becomes visible inpg_stat_activity and related catalogs, has its logic divided into threeroutines with this commit, called in order at different steps of thebackend initialization:* pgstat_bestart_initial() sets up the backend entry with a minimalamount of information, reporting it with a new BackendState calledSTATE_STARTING while waiting for backend initialization and clientauthentication to complete. The main benefit that this offers isobservability, so as it is possible to monitor the backend activityduring authentication. This step happens earlier than in the logicprior to this commit. pgstat_beinit() happens earlier as well, beforeauthentication.* pgstat_bestart_security() reports the SSL/GSS status of theconnection, once authentication completes. Auxiliary processes, forexample, do not need to call this step, hence it is optional. Thisstep is called after performing authentication, same as previously.* pgstat_bestart_final() reports the user and database IDs, takes theentry out of STATE_STARTING, and reports its application_name. This iscalled as the last step of the three, once authentication completes.An injection point is added, with a test checking that the "starting"phase of a backend entry is visible in pg_stat_activity. Some follow-uppatches are planned to take advantage of this refactoring with moreinformation provided in backend entries during authentication (LDAPhanging was a problem for the author, initially).Author: Jacob Champion <jacob.champion@enterprisedb.com>Reviewed-by: Michael Paquier <michael@paquier.xyz>Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/CAOYmi+=60deN20WDyCoHCiecgivJxr=98s7s7-C8SkXwrCfHXg@mail.gmail.com1 parent40d3f82 commitc76db55
File tree
9 files changed
+272
-84
lines changed- doc/src/sgml
- src
- backend
- postmaster
- utils
- activity
- adt
- init
- include/utils
- test/authentication
- t
9 files changed
+272
-84
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
899 | 899 |
| |
900 | 900 |
| |
901 | 901 |
| |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
902 | 908 |
| |
903 | 909 |
| |
904 | 910 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
81 |
| - | |
| 81 | + | |
| 82 | + | |
82 | 83 |
| |
83 | 84 |
| |
84 | 85 |
| |
|
Lines changed: 138 additions & 72 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
255 | 255 |
| |
256 | 256 |
| |
257 | 257 |
| |
258 |
| - | |
| 258 | + | |
259 | 259 |
| |
260 |
| - | |
261 |
| - | |
| 260 | + | |
| 261 | + | |
262 | 262 |
| |
263 |
| - | |
264 |
| - | |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
269 | 268 |
| |
270 | 269 |
| |
271 |
| - | |
| 270 | + | |
272 | 271 |
| |
273 | 272 |
| |
274 | 273 |
| |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - | |
280 |
| - | |
281 | 274 |
| |
282 | 275 |
| |
283 | 276 |
| |
| |||
297 | 290 |
| |
298 | 291 |
| |
299 | 292 |
| |
300 |
| - | |
301 |
| - | |
302 |
| - | |
303 |
| - | |
304 |
| - | |
305 |
| - | |
306 |
| - | |
307 |
| - | |
308 | 293 |
| |
309 | 294 |
| |
310 | 295 |
| |
| |||
315 | 300 |
| |
316 | 301 |
| |
317 | 302 |
| |
318 |
| - | |
319 |
| - | |
320 |
| - | |
321 |
| - | |
322 |
| - | |
323 |
| - | |
324 |
| - | |
325 |
| - | |
326 |
| - | |
| 303 | + | |
| 304 | + | |
327 | 305 |
| |
328 | 306 |
| |
329 | 307 |
| |
| |||
336 | 314 |
| |
337 | 315 |
| |
338 | 316 |
| |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 |
| - | |
355 | 317 |
| |
356 |
| - | |
357 |
| - | |
358 |
| - | |
359 |
| - | |
360 |
| - | |
361 |
| - | |
362 |
| - | |
363 |
| - | |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 | 318 |
| |
376 |
| - | |
377 | 319 |
| |
378 |
| - | |
| 320 | + | |
379 | 321 |
| |
380 | 322 |
| |
381 | 323 |
| |
| |||
417 | 359 |
| |
418 | 360 |
| |
419 | 361 |
| |
| 362 | + | |
420 | 363 |
| |
421 |
| - | |
| 364 | + | |
422 | 365 |
| |
423 | 366 |
| |
424 |
| - | |
| 367 | + | |
425 | 368 |
| |
426 | 369 |
| |
427 | 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 | + | |
428 | 494 |
| |
429 | 495 |
| |
430 | 496 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
393 | 393 |
| |
394 | 394 |
| |
395 | 395 |
| |
| 396 | + | |
| 397 | + | |
| 398 | + | |
396 | 399 |
| |
397 | 400 |
| |
398 | 401 |
| |
|
Lines changed: 30 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| 62 | + | |
62 | 63 |
| |
63 | 64 |
| |
64 | 65 |
| |
| |||
718 | 719 |
| |
719 | 720 |
| |
720 | 721 |
| |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
721 | 736 |
| |
722 | 737 |
| |
723 | 738 |
| |
| |||
786 | 801 |
| |
787 | 802 |
| |
788 | 803 |
| |
789 |
| - | |
790 |
| - | |
791 |
| - | |
792 | 804 |
| |
793 | 805 |
| |
794 | 806 |
| |
| |||
809 | 821 |
| |
810 | 822 |
| |
811 | 823 |
| |
812 |
| - | |
813 |
| - | |
| 824 | + | |
| 825 | + | |
814 | 826 |
| |
815 | 827 |
| |
816 | 828 |
| |
| |||
884 | 896 |
| |
885 | 897 |
| |
886 | 898 |
| |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
887 | 907 |
| |
888 | 908 |
| |
889 | 909 |
| |
| |||
953 | 973 |
| |
954 | 974 |
| |
955 | 975 |
| |
956 |
| - | |
957 |
| - | |
| 976 | + | |
| 977 | + | |
958 | 978 |
| |
959 | 979 |
| |
960 | 980 |
| |
| |||
997 | 1017 |
| |
998 | 1018 |
| |
999 | 1019 |
| |
1000 |
| - | |
| 1020 | + | |
1001 | 1021 |
| |
1002 | 1022 |
| |
1003 | 1023 |
| |
| |||
1197 | 1217 |
| |
1198 | 1218 |
| |
1199 | 1219 |
| |
1200 |
| - | |
| 1220 | + | |
1201 | 1221 |
| |
1202 |
| - | |
| 1222 | + | |
1203 | 1223 |
| |
1204 | 1224 |
| |
1205 | 1225 |
| |
|
0 commit comments
Comments
(0)