forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfc415ed
committed
Add callbacks to control flush of fixed-numbered stats
This commit adds two callbacks in pgstats to have a better control ofthe flush timing of pgstat_report_stat(), whose operation depends on thethree PGSTAT_*_INTERVAL variables:- have_fixed_pending_cb(), to check if a stats kind has any pendingdata waiting for a flush. This is used as a fast path if there are nopending statistics to flush, and this check is done for fixed-numberedstatistics only if there are no variable-numbered statistics to flush.A flush will need to happen if at least one callback reports any pendingdata.- flush_fixed_cb(), to do the actual flush.These callbacks are currently used by the SLRU, WAL and IO statistics,generalizing the concept for all stats kinds (builtin and custom).The SLRU and IO stats relied each on one global variable to determinewhether a flush should happen; these are now local to pgstat_slru.c andpgstat_io.c, cleaning up a bit how the pending flush states are trackedin pgstat.c.pgstat_flush_io() and pgstat_flush_wal() are still required, but we donot need to check their return result anymore.Reviewed-by: Bertrand Drouvot, Kyotaro HoriguchiDiscussion:https://postgr.es/m/ZtaVO0N-aTwiAk3w@paquier.xyz1 parent2e62fa6 commitfc415ed
File tree
5 files changed
+119
-40
lines changed- src
- backend/utils/activity
- include/utils
5 files changed
+119
-40
lines changedLines changed: 51 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
411 | 411 |
| |
412 | 412 |
| |
413 | 413 |
| |
| 414 | + | |
| 415 | + | |
414 | 416 |
| |
415 | 417 |
| |
416 | 418 |
| |
| |||
426 | 428 |
| |
427 | 429 |
| |
428 | 430 |
| |
| 431 | + | |
| 432 | + | |
429 | 433 |
| |
430 | 434 |
| |
431 | 435 |
| |
| |||
442 | 446 |
| |
443 | 447 |
| |
444 | 448 |
| |
| 449 | + | |
| 450 | + | |
445 | 451 |
| |
446 | 452 |
| |
447 | 453 |
| |
| |||
671 | 677 |
| |
672 | 678 |
| |
673 | 679 |
| |
674 |
| - | |
675 |
| - | |
676 |
| - | |
677 |
| - | |
| 680 | + | |
678 | 681 |
| |
679 |
| - | |
680 |
| - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
681 | 711 |
| |
682 | 712 |
| |
683 | 713 |
| |
| |||
730 | 760 |
| |
731 | 761 |
| |
732 | 762 |
| |
733 |
| - | |
734 |
| - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
735 | 767 |
| |
736 |
| - | |
737 |
| - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
738 | 777 |
| |
739 |
| - | |
740 |
| - | |
| 778 | + | |
| 779 | + | |
741 | 780 |
| |
742 | 781 |
| |
743 | 782 |
| |
|
Lines changed: 20 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
161 | 161 |
| |
162 | 162 |
| |
163 | 163 |
| |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
164 | 182 |
| |
165 | 183 |
| |
166 | 184 |
| |
| |||
170 | 188 |
| |
171 | 189 |
| |
172 | 190 |
| |
173 |
| - | |
| 191 | + | |
174 | 192 |
| |
175 | 193 |
| |
176 | 194 |
| |
|
Lines changed: 11 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
| 35 | + | |
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| |||
143 | 143 |
| |
144 | 144 |
| |
145 | 145 |
| |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
146 | 155 |
| |
147 | 156 |
| |
148 | 157 |
| |
| |||
153 | 162 |
| |
154 | 163 |
| |
155 | 164 |
| |
156 |
| - | |
| 165 | + | |
157 | 166 |
| |
158 | 167 |
| |
159 | 168 |
| |
|
Lines changed: 14 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 |
| |
75 | 84 |
| |
76 | 85 |
| |
| |||
79 | 88 |
| |
80 | 89 |
| |
81 | 90 |
| |
82 |
| - | |
| 91 | + | |
83 | 92 |
| |
84 | 93 |
| |
85 | 94 |
| |
| |||
92 | 101 |
| |
93 | 102 |
| |
94 | 103 |
| |
95 |
| - | |
| 104 | + | |
96 | 105 |
| |
97 | 106 |
| |
98 | 107 |
| |
| |||
141 | 150 |
| |
142 | 151 |
| |
143 | 152 |
| |
144 |
| - | |
145 |
| - | |
| 153 | + | |
| 154 | + | |
146 | 155 |
| |
147 | 156 |
| |
148 | 157 |
| |
| |||
156 | 165 |
| |
157 | 166 |
| |
158 | 167 |
| |
159 |
| - | |
| 168 | + | |
160 | 169 |
| |
161 | 170 |
| |
162 | 171 |
| |
|
Lines changed: 23 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
237 | 237 |
| |
238 | 238 |
| |
239 | 239 |
| |
240 |
| - | |
| 240 | + | |
241 | 241 |
| |
242 | 242 |
| |
243 | 243 |
| |
| |||
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
268 | 281 |
| |
269 | 282 |
| |
270 | 283 |
| |
| |||
609 | 622 |
| |
610 | 623 |
| |
611 | 624 |
| |
612 |
| - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
613 | 629 |
| |
614 | 630 |
| |
615 | 631 |
| |
| |||
668 | 684 |
| |
669 | 685 |
| |
670 | 686 |
| |
671 |
| - | |
| 687 | + | |
| 688 | + | |
672 | 689 |
| |
673 | 690 |
| |
674 | 691 |
| |
| |||
678 | 695 |
| |
679 | 696 |
| |
680 | 697 |
| |
681 |
| - | |
682 |
| - | |
| 698 | + | |
683 | 699 |
| |
684 | 700 |
| |
| 701 | + | |
| 702 | + | |
685 | 703 |
| |
686 | 704 |
| |
687 | 705 |
| |
| |||
711 | 729 |
| |
712 | 730 |
| |
713 | 731 |
| |
714 |
| - | |
715 |
| - | |
716 |
| - | |
717 |
| - | |
718 |
| - | |
719 |
| - | |
720 |
| - | |
721 |
| - | |
722 |
| - | |
723 |
| - | |
724 |
| - | |
725 |
| - | |
726 |
| - | |
727 |
| - | |
728 | 732 |
| |
729 | 733 |
| |
730 | 734 |
| |
|
0 commit comments
Comments
(0)