- Notifications
You must be signed in to change notification settings - Fork28
Commit558a916
committed
Compute XID horizon for page level index vacuum on primary.
Previously the xid horizon was only computed during WAL replay. Thathad two major problems:1) It relied on knowing what the table pointed to looks like. That was easy enough before the introducing of tableam (we knew it had to be heap, although some trickery around logging the heap relfilenodes was required). But to properly handle table AMs we need per-database catalog access to look up the AM handler, which recovery doesn't allow.2) Not knowing the xid horizon also makes it hard to support logical decoding on standbys. When on a catalog table, we need to be able to conflict with slots that have an xid horizon that's too old. But computing the horizon by visiting the heap only works once consistency is reached, but we always need to be able to detect conflicts.There's also a secondary problem, in that the current method performsredundant work on every standby. But that's counterbalanced bypotentially computing the value when not necessary (either becausethere's no standby, or because there's no connected backends).Solve 1) and 2) by moving computation of the xid horizon to theprimary and by involving tableam in the computation of the horizon.To address the potentially increased overhead, increase the efficiencyof the xid horizon computation for heap by sorting the tids, andeliminating redundant buffer accesses. When prefetching is available,additionally perform prefetching of buffers. As this is more of amaintenance task, rather than something routinely done in every readonly query, we add an arbitrary 10 to the effective concurrency -thereby using IO concurrency, when not globally enabled. That'spossibly not the perfect formula, but seems good enough for now.Bumps WAL format, as latestRemovedXid is now part of the records, andthe heap's relfilenode isn't anymore.Author: Andres Freund, Amit Khandekar, Robert HaasReviewed-By: Robert HaasDiscussion:https://postgr.es/m/20181212204154.nsxf3gzqv3gesl32@alap3.anarazel.dehttps://postgr.es/m/20181214014235.dal5ogljs3bmlq44@alap3.anarazel.dehttps://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de1 parent126d631 commit558a916
File tree
16 files changed
+316
-321
lines changed- src
- backend/access
- hash
- heap
- index
- nbtree
- rmgrdesc
- include/access
- tools/pgindent
16 files changed
+316
-321
lines changedLines changed: 1 addition & 152 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
969 | 969 |
| |
970 | 970 |
| |
971 | 971 |
| |
972 |
| - | |
973 |
| - | |
974 |
| - | |
975 |
| - | |
976 |
| - | |
977 |
| - | |
978 |
| - | |
979 |
| - | |
980 |
| - | |
981 |
| - | |
982 |
| - | |
983 |
| - | |
984 |
| - | |
985 |
| - | |
986 |
| - | |
987 |
| - | |
988 |
| - | |
989 |
| - | |
990 |
| - | |
991 |
| - | |
992 |
| - | |
993 |
| - | |
994 |
| - | |
995 |
| - | |
996 |
| - | |
997 |
| - | |
998 |
| - | |
999 |
| - | |
1000 |
| - | |
1001 |
| - | |
1002 |
| - | |
1003 |
| - | |
1004 |
| - | |
1005 |
| - | |
1006 |
| - | |
1007 |
| - | |
1008 |
| - | |
1009 |
| - | |
1010 |
| - | |
1011 |
| - | |
1012 |
| - | |
1013 |
| - | |
1014 |
| - | |
1015 |
| - | |
1016 |
| - | |
1017 |
| - | |
1018 |
| - | |
1019 |
| - | |
1020 |
| - | |
1021 |
| - | |
1022 |
| - | |
1023 |
| - | |
1024 |
| - | |
1025 |
| - | |
1026 |
| - | |
1027 |
| - | |
1028 |
| - | |
1029 |
| - | |
1030 |
| - | |
1031 |
| - | |
1032 |
| - | |
1033 |
| - | |
1034 |
| - | |
1035 |
| - | |
1036 |
| - | |
1037 |
| - | |
1038 |
| - | |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 |
| - | |
1044 |
| - | |
1045 |
| - | |
1046 |
| - | |
1047 |
| - | |
1048 |
| - | |
1049 |
| - | |
1050 |
| - | |
1051 |
| - | |
1052 |
| - | |
1053 |
| - | |
1054 |
| - | |
1055 |
| - | |
1056 |
| - | |
1057 |
| - | |
1058 |
| - | |
1059 |
| - | |
1060 |
| - | |
1061 |
| - | |
1062 |
| - | |
1063 |
| - | |
1064 |
| - | |
1065 |
| - | |
1066 |
| - | |
1067 |
| - | |
1068 |
| - | |
1069 |
| - | |
1070 |
| - | |
1071 |
| - | |
1072 |
| - | |
1073 |
| - | |
1074 |
| - | |
1075 |
| - | |
1076 |
| - | |
1077 |
| - | |
1078 |
| - | |
1079 |
| - | |
1080 |
| - | |
1081 |
| - | |
1082 |
| - | |
1083 |
| - | |
1084 |
| - | |
1085 |
| - | |
1086 |
| - | |
1087 |
| - | |
1088 |
| - | |
1089 |
| - | |
1090 |
| - | |
1091 |
| - | |
1092 |
| - | |
1093 |
| - | |
1094 |
| - | |
1095 |
| - | |
1096 |
| - | |
1097 |
| - | |
1098 |
| - | |
1099 |
| - | |
1100 |
| - | |
1101 |
| - | |
1102 |
| - | |
1103 |
| - | |
1104 |
| - | |
1105 |
| - | |
1106 |
| - | |
1107 |
| - | |
1108 |
| - | |
1109 |
| - | |
1110 |
| - | |
1111 |
| - | |
1112 |
| - | |
1113 |
| - | |
1114 |
| - | |
1115 |
| - | |
1116 |
| - | |
1117 |
| - | |
1118 |
| - | |
1119 |
| - | |
1120 |
| - | |
1121 | 972 |
| |
1122 | 973 |
| |
1123 | 974 |
| |
| |||
1149 | 1000 |
| |
1150 | 1001 |
| |
1151 | 1002 |
| |
1152 |
| - | |
1153 |
| - | |
1154 | 1003 |
| |
1155 | 1004 |
| |
1156 | 1005 |
| |
1157 |
| - | |
| 1006 | + | |
1158 | 1007 |
| |
1159 | 1008 |
| |
1160 | 1009 |
| |
|
Lines changed: 11 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 |
| - | |
27 |
| - | |
| 26 | + | |
| 27 | + | |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
140 |
| - | |
| 140 | + | |
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
| |||
335 | 335 |
| |
336 | 336 |
| |
337 | 337 |
| |
338 |
| - | |
339 |
| - | |
| 338 | + | |
340 | 339 |
| |
341 | 340 |
| |
342 | 341 |
| |
| |||
360 | 359 |
| |
361 | 360 |
| |
362 | 361 |
| |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
363 | 368 |
| |
364 | 369 |
| |
365 | 370 |
| |
| |||
393 | 398 |
| |
394 | 399 |
| |
395 | 400 |
| |
396 |
| - | |
| 401 | + | |
397 | 402 |
| |
398 | 403 |
| |
399 | 404 |
| |
|
0 commit comments
Comments
(0)