forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit22f6f2c
committed
Improve management of statement timeouts.
Commitf8e5f15 added private state in postgres.c to track whethera statement timeout is running. This seems like bad design to me;timeout.c's private state should be the single source of truth aboutthat. We already fixed one bug associated with failure to keep thosestates in sync (cf.be42015), and I've got little faith that wewon't find more in future. So get rid of postgres.c's local variableby exposing a way to ask timeout.c whether a timeout is running.(Obviously, such an inquiry is subject to race conditions, but itseems fine for the purpose at hand.)To make get_timeout_active() as cheap as possible, add a flag inthe per-timeout struct showing whether that timeout is active.This allows some small savings elsewhere in timeout.c, mainlyelimination of unnecessary searches of the active_timeouts array.While at it, fix enable_statement_timeout to not call disable_timeoutwhen statement_timeout is 0 and the timeout is not running. Thisavoids a useless deschedule-and-reschedule-timeouts cycle, whichrepresents a significant savings (at least one kernel call) whenthere is any other active timeout. Right now, there usually isn't,but there are proposals around to change that.Discussion:https://postgr.es/m/16035-456e6e69ebfd4374@postgresql.org1 parent2b2bacd commit22f6f2c
File tree
3 files changed
+39
-33
lines changed- src
- backend
- tcop
- utils/misc
- include/utils
3 files changed
+39
-33
lines changedLines changed: 6 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 |
| - | |
149 |
| - | |
150 |
| - | |
151 |
| - | |
152 |
| - | |
153 | 148 |
| |
154 | 149 |
| |
155 | 150 |
| |
| |||
4029 | 4024 |
| |
4030 | 4025 |
| |
4031 | 4026 |
| |
4032 |
| - | |
4033 | 4027 |
| |
4034 | 4028 |
| |
4035 | 4029 |
| |
| |||
4711 | 4705 |
| |
4712 | 4706 |
| |
4713 | 4707 |
| |
4714 |
| - | |
4715 |
| - | |
| 4708 | + | |
4716 | 4709 |
| |
4717 |
| - | |
4718 |
| - | |
4719 | 4710 |
| |
4720 | 4711 |
| |
4721 |
| - | |
| 4712 | + | |
| 4713 | + | |
| 4714 | + | |
| 4715 | + | |
4722 | 4716 |
| |
4723 | 4717 |
| |
4724 | 4718 |
| |
| |||
4727 | 4721 |
| |
4728 | 4722 |
| |
4729 | 4723 |
| |
4730 |
| - | |
4731 |
| - | |
| 4724 | + | |
4732 | 4725 |
| |
4733 |
| - | |
4734 |
| - | |
4735 |
| - | |
4736 | 4726 |
|
Lines changed: 32 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
| 30 | + | |
| 31 | + | |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| |||
105 | 106 |
| |
106 | 107 |
| |
107 | 108 |
| |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 |
| |
109 | 113 |
| |
110 | 114 |
| |
| |||
125 | 129 |
| |
126 | 130 |
| |
127 | 131 |
| |
| 132 | + | |
| 133 | + | |
| 134 | + | |
128 | 135 |
| |
129 | 136 |
| |
130 | 137 |
| |
| |||
147 | 154 |
| |
148 | 155 |
| |
149 | 156 |
| |
150 |
| - | |
151 |
| - | |
152 |
| - | |
| 157 | + | |
| 158 | + | |
153 | 159 |
| |
154 | 160 |
| |
155 | 161 |
| |
| |||
349 | 355 |
| |
350 | 356 |
| |
351 | 357 |
| |
| 358 | + | |
352 | 359 |
| |
353 | 360 |
| |
354 | 361 |
| |
| |||
524 | 531 |
| |
525 | 532 |
| |
526 | 533 |
| |
527 |
| - | |
528 |
| - | |
529 | 534 |
| |
530 | 535 |
| |
531 | 536 |
| |
| |||
534 | 539 |
| |
535 | 540 |
| |
536 | 541 |
| |
537 |
| - | |
538 |
| - | |
539 |
| - | |
| 542 | + | |
| 543 | + | |
540 | 544 |
| |
541 | 545 |
| |
542 | 546 |
| |
| |||
571 | 575 |
| |
572 | 576 |
| |
573 | 577 |
| |
574 |
| - | |
575 | 578 |
| |
576 | 579 |
| |
577 | 580 |
| |
578 |
| - | |
579 |
| - | |
580 |
| - | |
| 581 | + | |
| 582 | + | |
581 | 583 |
| |
582 | 584 |
| |
583 | 585 |
| |
| |||
595 | 597 |
| |
596 | 598 |
| |
597 | 599 |
| |
| 600 | + | |
| 601 | + | |
598 | 602 |
| |
599 | 603 |
| |
600 | 604 |
| |
| |||
613 | 617 |
| |
614 | 618 |
| |
615 | 619 |
| |
616 |
| - | |
| 620 | + | |
617 | 621 |
| |
618 |
| - | |
619 |
| - | |
620 |
| - | |
| 622 | + | |
| 623 | + | |
621 | 624 |
| |
622 | 625 |
| |
623 | 626 |
| |
624 | 627 |
| |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
625 | 640 |
| |
626 | 641 |
| |
627 | 642 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
| 83 | + | |
83 | 84 |
| |
84 | 85 |
| |
85 | 86 |
| |
|
0 commit comments
Comments
(0)