- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit8b1dccd
committed
pgstat: scaffolding for transactional stats creation / drop.
One problematic part of the current statistics collector design is that thereis no reliable way of getting rid of statistics entries. Because of thatpgstat_vacuum_stat() (called by [auto-]vacuum) matches all stats for thecurrent database with the catalog contents and tries to drop now-superfluousentries. That's quite expensive. What's worse, it doesn't work on physicalreplicas, despite physical replicas collection statistics entries.This commit introduces infrastructure to create / drop statistics entriestransactionally, together with the underlying catalog objects (functions,relations, subscriptions). pgstat_xact.c maintains a list of stats entriescreated / dropped transactionally in the current transaction. To ensure theremoval of statistics entries is durable dropped statistics entries areincluded in commit / abort (and prepare) records, which also ensures thatstats entries are dropped on standbys.Statistics entries created separately from creating the underlying catalogobject (e.g. when stats were previously lost due to an immediate restart)are *not* WAL logged. However that can only happen outside of the transactioncreating the catalog object, so it does not lead to "leaked" statisticsentries.For this to work, functions creating / dropping functions / relations /subscriptions need to call into pgstat. For subscriptions this was alreadydone when dropping subscriptions, via pgstat_report_subscription_drop() (nowrenamed to pgstat_drop_subscription()).This commit does not actually drop stats yet, it just provides theinfrastructure. It is however a largely independent piece of infrastructure,so committing it separately makes sense.Bumps XLOG_PAGE_MAGIC.Author: Andres Freund <andres@anarazel.de>Reviewed-By: Thomas Munro <thomas.munro@gmail.com>Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>Discussion:https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de1 parent8fb580a commit8b1dccd
File tree
18 files changed
+524
-36
lines changed- src
- backend
- access
- rmgrdesc
- transam
- catalog
- commands
- postmaster
- storage/smgr
- utils/activity
- include
- access
- utils
- tools/pgindent
18 files changed
+524
-36
lines changedLines changed: 52 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
87 | 98 |
| |
88 | 99 |
| |
89 | 100 |
| |
| |||
179 | 190 |
| |
180 | 191 |
| |
181 | 192 |
| |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
182 | 204 |
| |
183 | 205 |
| |
184 | 206 |
| |
| |||
244 | 266 |
| |
245 | 267 |
| |
246 | 268 |
| |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
247 | 275 |
| |
248 | 276 |
| |
249 | 277 |
| |
| |||
280 | 308 |
| |
281 | 309 |
| |
282 | 310 |
| |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
283 | 330 |
| |
284 | 331 |
| |
285 | 332 |
| |
| |||
295 | 342 |
| |
296 | 343 |
| |
297 | 344 |
| |
| 345 | + | |
298 | 346 |
| |
299 | 347 |
| |
300 | 348 |
| |
| |||
338 | 386 |
| |
339 | 387 |
| |
340 | 388 |
| |
| 389 | + | |
| 390 | + | |
341 | 391 |
| |
342 | 392 |
| |
343 | 393 |
| |
| |||
353 | 403 |
| |
354 | 404 |
| |
355 | 405 |
| |
| 406 | + | |
| 407 | + | |
356 | 408 |
| |
357 | 409 |
| |
358 | 410 |
| |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
205 | 205 |
| |
206 | 206 |
| |
207 | 207 |
| |
| 208 | + | |
| 209 | + | |
208 | 210 |
| |
209 | 211 |
| |
210 | 212 |
| |
| |||
214 | 216 |
| |
215 | 217 |
| |
216 | 218 |
| |
| 219 | + | |
| 220 | + | |
217 | 221 |
| |
218 | 222 |
| |
219 | 223 |
| |
| |||
1046 | 1050 |
| |
1047 | 1051 |
| |
1048 | 1052 |
| |
| 1053 | + | |
| 1054 | + | |
1049 | 1055 |
| |
1050 | 1056 |
| |
1051 | 1057 |
| |
| |||
1071 | 1077 |
| |
1072 | 1078 |
| |
1073 | 1079 |
| |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1074 | 1084 |
| |
1075 | 1085 |
| |
1076 | 1086 |
| |
| |||
1101 | 1111 |
| |
1102 | 1112 |
| |
1103 | 1113 |
| |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
1104 | 1126 |
| |
1105 | 1127 |
| |
1106 | 1128 |
| |
| |||
1472 | 1494 |
| |
1473 | 1495 |
| |
1474 | 1496 |
| |
| 1497 | + | |
| 1498 | + | |
1475 | 1499 |
| |
1476 | 1500 |
| |
1477 | 1501 |
| |
| |||
1506 | 1530 |
| |
1507 | 1531 |
| |
1508 | 1532 |
| |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
1509 | 1537 |
| |
1510 | 1538 |
| |
1511 | 1539 |
| |
| |||
1527 | 1555 |
| |
1528 | 1556 |
| |
1529 | 1557 |
| |
| 1558 | + | |
| 1559 | + | |
1530 | 1560 |
| |
1531 | 1561 |
| |
1532 | 1562 |
| |
1533 | 1563 |
| |
1534 | 1564 |
| |
1535 | 1565 |
| |
| 1566 | + | |
| 1567 | + | |
1536 | 1568 |
| |
1537 | 1569 |
| |
1538 | 1570 |
| |
| |||
1568 | 1600 |
| |
1569 | 1601 |
| |
1570 | 1602 |
| |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
1571 | 1608 |
| |
1572 | 1609 |
| |
1573 | 1610 |
| |
| |||
2066 | 2103 |
| |
2067 | 2104 |
| |
2068 | 2105 |
| |
| 2106 | + | |
| 2107 | + | |
2069 | 2108 |
| |
2070 | 2109 |
| |
2071 | 2110 |
| |
| |||
2248 | 2287 |
| |
2249 | 2288 |
| |
2250 | 2289 |
| |
| 2290 | + | |
| 2291 | + | |
2251 | 2292 |
| |
2252 | 2293 |
| |
2253 | 2294 |
| |
| |||
2277 | 2318 |
| |
2278 | 2319 |
| |
2279 | 2320 |
| |
| 2321 | + | |
2280 | 2322 |
| |
2281 | 2323 |
| |
2282 | 2324 |
| |
| |||
2343 | 2385 |
| |
2344 | 2386 |
| |
2345 | 2387 |
| |
| 2388 | + | |
| 2389 | + | |
2346 | 2390 |
| |
2347 | 2391 |
| |
2348 | 2392 |
| |
| |||
2373 | 2417 |
| |
2374 | 2418 |
| |
2375 | 2419 |
| |
| 2420 | + | |
2376 | 2421 |
| |
2377 | 2422 |
| |
2378 | 2423 |
| |
|
0 commit comments
Comments
(0)