File tree
5 files changed
+76
-85
lines changed- src
- backend
- access/transam
- postmaster
- utils/adt
- include
- access
5 files changed
+76
-85
lines changedLines changed: 12 additions & 15 deletions
@@ -191,6 +191,8 @@ SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
191
191
192
192
/* shared->latest_page_number will be set later */
193
193
194
+ shared->slru_stats_idx = pgstat_slru_index(name);
195
+
194
196
ptr = (char *) shared;
195
197
offset = MAXALIGN(sizeof(SlruSharedData));
196
198
shared->page_buffer = (char **) (ptr + offset);
@@ -214,15 +216,11 @@ SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
214
216
offset += MAXALIGN(nslots * nlsns * sizeof(XLogRecPtr));
215
217
}
216
218
217
- Assert(strlen(name) + 1 < SLRU_MAX_NAME_LENGTH);
218
- strlcpy(shared->lwlock_tranche_name, name, SLRU_MAX_NAME_LENGTH);
219
- shared->lwlock_tranche_id = tranche_id;
220
-
221
219
ptr += BUFFERALIGN(offset);
222
220
for (slotno = 0; slotno < nslots; slotno++)
223
221
{
224
222
LWLockInitialize(&shared->buffer_locks[slotno].lock,
225
- shared->lwlock_tranche_id);
223
+ tranche_id);
226
224
227
225
shared->page_buffer[slotno] = ptr;
228
226
shared->page_status[slotno] = SLRU_PAGE_EMPTY;
@@ -238,8 +236,7 @@ SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
238
236
Assert(found);
239
237
240
238
/* Register SLRU tranche in the main tranches array */
241
- LWLockRegisterTranche(shared->lwlock_tranche_id,
242
- shared->lwlock_tranche_name);
239
+ LWLockRegisterTranche(tranche_id, name);
243
240
244
241
/*
245
242
* Initialize the unshared control struct, including directory path. We
@@ -287,7 +284,7 @@ SimpleLruZeroPage(SlruCtl ctl, int pageno)
287
284
shared->latest_page_number = pageno;
288
285
289
286
/* update the stats counter of zeroed pages */
290
- pgstat_count_slru_page_zeroed(ctl);
287
+ pgstat_count_slru_page_zeroed(shared->slru_stats_idx);
291
288
292
289
return slotno;
293
290
}
@@ -408,7 +405,7 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
408
405
SlruRecentlyUsed(shared, slotno);
409
406
410
407
/* update the stats counter of pages found in the SLRU */
411
- pgstat_count_slru_page_hit(ctl);
408
+ pgstat_count_slru_page_hit(shared->slru_stats_idx);
412
409
413
410
return slotno;
414
411
}
@@ -453,7 +450,7 @@ SimpleLruReadPage(SlruCtl ctl, int pageno, bool write_ok,
453
450
SlruRecentlyUsed(shared, slotno);
454
451
455
452
/* update the stats counter of pages not found in SLRU */
456
- pgstat_count_slru_page_read(ctl);
453
+ pgstat_count_slru_page_read(shared->slru_stats_idx);
457
454
458
455
return slotno;
459
456
}
@@ -493,7 +490,7 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int pageno, TransactionId xid)
493
490
SlruRecentlyUsed(shared, slotno);
494
491
495
492
/* update the stats counter of pages found in the SLRU */
496
- pgstat_count_slru_page_hit(ctl);
493
+ pgstat_count_slru_page_hit(shared->slru_stats_idx);
497
494
498
495
return slotno;
499
496
}
@@ -612,7 +609,7 @@ SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int pageno)
612
609
off_t endpos;
613
610
614
611
/* update the stats counter of checked pages */
615
- pgstat_count_slru_page_exists(ctl);
612
+ pgstat_count_slru_page_exists(ctl->shared->slru_stats_idx);
616
613
617
614
SlruFileName(ctl, path, segno);
618
615
@@ -749,7 +746,7 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
749
746
int fd = -1;
750
747
751
748
/* update the stats counter of written pages */
752
- pgstat_count_slru_page_written(ctl);
749
+ pgstat_count_slru_page_written(shared->slru_stats_idx);
753
750
754
751
/*
755
752
* Honor the write-WAL-before-data rule, if appropriate, so that we do not
@@ -1147,7 +1144,7 @@ SimpleLruFlush(SlruCtl ctl, bool allow_redirtied)
1147
1144
bool ok;
1148
1145
1149
1146
/* update the stats counter of flushes */
1150
- pgstat_count_slru_flush(ctl);
1147
+ pgstat_count_slru_flush(shared->slru_stats_idx);
1151
1148
1152
1149
/*
1153
1150
* Find and write dirty pages
@@ -1211,7 +1208,7 @@ SimpleLruTruncate(SlruCtl ctl, int cutoffPage)
1211
1208
int slotno;
1212
1209
1213
1210
/* update the stats counter of truncates */
1214
- pgstat_count_slru_truncate(ctl);
1211
+ pgstat_count_slru_truncate(shared->slru_stats_idx);
1215
1212
1216
1213
/*
1217
1214
* The cutoff point is the start of the segment containing cutoffPage.
Lines changed: 50 additions & 46 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
142 | 142 |
| |
143 | 143 |
| |
144 | 144 |
| |
145 |
| - | |
146 |
| - | |
147 |
| - | |
148 |
| - | |
149 |
| - | |
150 |
| - | |
151 |
| - | |
152 |
| - | |
153 |
| - | |
154 |
| - | |
155 |
| - | |
156 |
| - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
157 | 161 |
| |
158 |
| - | |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 |
| - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
163 | 169 |
| |
164 | 170 |
| |
165 | 171 |
| |
| |||
4411 | 4417 |
| |
4412 | 4418 |
| |
4413 | 4419 |
| |
4414 |
| - | |
4415 |
| - | |
4416 | 4420 |
| |
4417 | 4421 |
| |
4418 | 4422 |
| |
4419 |
| - | |
| 4423 | + | |
4420 | 4424 |
| |
4421 | 4425 |
| |
4422 | 4426 |
| |
| |||
6705 | 6709 |
| |
6706 | 6710 |
| |
6707 | 6711 |
| |
6708 |
| - | |
6709 |
| - | |
| 6712 | + | |
| 6713 | + | |
6710 | 6714 |
| |
6711 |
| - | |
6712 |
| - | |
6713 |
| - | |
| 6715 | + | |
6714 | 6716 |
| |
6715 | 6717 |
| |
6716 |
| - | |
| 6718 | + | |
6717 | 6719 |
| |
6718 | 6720 |
| |
6719 | 6721 |
| |
| |||
6722 | 6724 |
| |
6723 | 6725 |
| |
6724 | 6726 |
| |
6725 |
| - | |
6726 |
| - | |
| 6727 | + | |
| 6728 | + | |
6727 | 6729 |
| |
6728 |
| - | |
6729 |
| - | |
6730 |
| - | |
| 6730 | + | |
6731 | 6731 |
| |
6732 |
| - | |
| 6732 | + | |
6733 | 6733 |
| |
6734 | 6734 |
| |
| 6735 | + | |
| 6736 | + | |
| 6737 | + | |
| 6738 | + | |
6735 | 6739 |
| |
6736 |
| - | |
| 6740 | + | |
6737 | 6741 |
| |
6738 |
| - | |
| 6742 | + | |
6739 | 6743 |
| |
6740 | 6744 |
| |
6741 | 6745 |
| |
6742 |
| - | |
| 6746 | + | |
6743 | 6747 |
| |
6744 |
| - | |
| 6748 | + | |
6745 | 6749 |
| |
6746 | 6750 |
| |
6747 | 6751 |
| |
6748 |
| - | |
| 6752 | + | |
6749 | 6753 |
| |
6750 |
| - | |
| 6754 | + | |
6751 | 6755 |
| |
6752 | 6756 |
| |
6753 | 6757 |
| |
6754 |
| - | |
| 6758 | + | |
6755 | 6759 |
| |
6756 |
| - | |
| 6760 | + | |
6757 | 6761 |
| |
6758 | 6762 |
| |
6759 | 6763 |
| |
6760 |
| - | |
| 6764 | + | |
6761 | 6765 |
| |
6762 |
| - | |
| 6766 | + | |
6763 | 6767 |
| |
6764 | 6768 |
| |
6765 | 6769 |
| |
6766 |
| - | |
| 6770 | + | |
6767 | 6771 |
| |
6768 |
| - | |
| 6772 | + | |
6769 | 6773 |
| |
6770 | 6774 |
| |
6771 | 6775 |
| |
6772 |
| - | |
| 6776 | + | |
6773 | 6777 |
| |
6774 |
| - | |
| 6778 | + | |
6775 | 6779 |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1739 | 1739 |
| |
1740 | 1740 |
| |
1741 | 1741 |
| |
1742 |
| - | |
| 1742 | + | |
1743 | 1743 |
| |
1744 | 1744 |
| |
1745 | 1745 |
| |
|
Lines changed: 3 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 | 35 |
| |
39 | 36 |
| |
40 | 37 |
| |
| |||
68 | 65 |
| |
69 | 66 |
| |
70 | 67 |
| |
| 68 | + | |
71 | 69 |
| |
72 | 70 |
| |
73 | 71 |
| |
| |||
98 | 96 |
| |
99 | 97 |
| |
100 | 98 |
| |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
| 99 | + | |
| 100 | + | |
105 | 101 |
| |
106 | 102 |
| |
107 | 103 |
| |
|
Lines changed: 10 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 |
| - | |
15 | 14 |
| |
16 | 15 |
| |
17 | 16 |
| |
| |||
438 | 437 |
| |
439 | 438 |
| |
440 | 439 |
| |
441 |
| - | |
| 440 | + | |
442 | 441 |
| |
443 | 442 |
| |
444 | 443 |
| |
| |||
1260 | 1259 |
| |
1261 | 1260 |
| |
1262 | 1261 |
| |
1263 |
| - | |
1264 |
| - | |
1265 |
| - | |
1266 |
| - | |
1267 |
| - | |
1268 | 1262 |
| |
1269 | 1263 |
| |
1270 | 1264 |
| |
| |||
1480 | 1474 |
| |
1481 | 1475 |
| |
1482 | 1476 |
| |
1483 |
| - | |
1484 |
| - | |
1485 |
| - | |
1486 |
| - | |
1487 |
| - | |
1488 |
| - | |
1489 |
| - | |
1490 |
| - | |
1491 |
| - | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
1492 | 1486 |
| |
1493 | 1487 |
|
0 commit comments