- Notifications
You must be signed in to change notification settings - Fork5
Commit73b796a
committed
Improve coding around the fsync request queue.
In all branches back to 8.3, this patch fixes a questionable assumption inCompactCheckpointerRequestQueue/CompactBgwriterRequestQueue that there areno uninitialized pad bytes in the request queue structs. This would onlycause trouble if (a) there were such pad bytes, which could happen in 8.4and up if the compiler makes enum ForkNumber narrower than 32 bits, butotherwise would require not-currently-planned changes in the widths ofother typedefs; and (b) the kernel has not uniformly initialized thecontents of shared memory to zeroes. Still, it seems a tad risky, and wecan easily remove any risk by pre-zeroing the request array for ourselves.In addition to that, we need to establish a coding rule that structRelFileNode can't contain any padding bytes, since such structs are copiedinto the request array verbatim. (There are other places that are assumingthis anyway, it turns out.)In 9.1 and up, the risk was a bit larger because we were also effectivelyassuming that struct RelFileNodeBackend contained no pad bytes, and withfields of different types in there, that would be much easier to break.However, there is no good reason to ever transmit fsync or delete requestsfor temp files to the bgwriter/checkpointer, so we can revert the requeststructs to plain RelFileNode, getting rid of the padding risk and savingsome marginal number of bytes and cycles in fsync queue manipulation whilewe are at it. The savings might be more than marginal during deletion ofa temp relation, because the old code transmitted an entirely useless butnonetheless expensive-to-process ForgetRelationFsync request to thebackground process, and also had the background process perform the filedeletion even though that can safely be done immediately.In addition, make some cleanup of nearby comments and small improvements tothe code in CompactCheckpointerRequestQueue/CompactBgwriterRequestQueue.1 parent71f2dd2 commit73b796a
File tree
6 files changed
+109
-58
lines changed- src
- backend
- postmaster
- storage
- buffer
- smgr
- include
- postmaster
- storage
6 files changed
+109
-58
lines changedLines changed: 36 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
108 |
| - | |
| 108 | + | |
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
| |||
924 | 924 |
| |
925 | 925 |
| |
926 | 926 |
| |
| 927 | + | |
927 | 928 |
| |
928 | 929 |
| |
929 | 930 |
| |
930 | 931 |
| |
931 |
| - | |
| 932 | + | |
932 | 933 |
| |
933 | 934 |
| |
934 | 935 |
| |
935 | 936 |
| |
936 |
| - | |
937 |
| - | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
938 | 943 |
| |
939 | 944 |
| |
940 | 945 |
| |
| |||
1091 | 1096 |
| |
1092 | 1097 |
| |
1093 | 1098 |
| |
1094 |
| - | |
| 1099 | + | |
1095 | 1100 |
| |
1096 | 1101 |
| |
1097 | 1102 |
| |
1098 | 1103 |
| |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1099 | 1108 |
| |
1100 | 1109 |
| |
1101 | 1110 |
| |
| |||
1112 | 1121 |
| |
1113 | 1122 |
| |
1114 | 1123 |
| |
1115 |
| - | |
1116 |
| - | |
| 1124 | + | |
1117 | 1125 |
| |
1118 | 1126 |
| |
1119 | 1127 |
| |
| |||
1169 | 1177 |
| |
1170 | 1178 |
| |
1171 | 1179 |
| |
| 1180 | + | |
1172 | 1181 |
| |
1173 | 1182 |
| |
1174 | 1183 |
| |
| |||
1178 | 1187 |
| |
1179 | 1188 |
| |
1180 | 1189 |
| |
1181 |
| - | |
| 1190 | + | |
1182 | 1191 |
| |
1183 | 1192 |
| |
1184 | 1193 |
| |
| |||
1200 | 1209 |
| |
1201 | 1210 |
| |
1202 | 1211 |
| |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1203 | 1215 |
| |
1204 | 1216 |
| |
1205 | 1217 |
| |
1206 | 1218 |
| |
1207 | 1219 |
| |
| 1220 | + | |
| 1221 | + | |
1208 | 1222 |
| |
1209 | 1223 |
| |
1210 | 1224 |
| |
1211 |
| - | |
1212 |
| - | |
1213 |
| - | |
1214 |
| - | |
| 1225 | + | |
1215 | 1226 |
| |
1216 | 1227 |
| |
1217 | 1228 |
| |
| |||
1226 | 1237 |
| |
1227 | 1238 |
| |
1228 | 1239 |
| |
1229 |
| - | |
| 1240 | + | |
1230 | 1241 |
| |
1231 | 1242 |
| |
1232 | 1243 |
| |
1233 | 1244 |
| |
1234 | 1245 |
| |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
1235 | 1253 |
| |
1236 | 1254 |
| |
1237 | 1255 |
| |
1238 | 1256 |
| |
| 1257 | + | |
1239 | 1258 |
| |
1240 |
| - | |
| 1259 | + | |
1241 | 1260 |
| |
| 1261 | + | |
1242 | 1262 |
| |
1243 | 1263 |
| |
1244 | 1264 |
| |
| |||
1253 | 1273 |
| |
1254 | 1274 |
| |
1255 | 1275 |
| |
1256 |
| - | |
| 1276 | + | |
| 1277 | + | |
1257 | 1278 |
| |
1258 | 1279 |
| |
1259 | 1280 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2049 | 2049 |
| |
2050 | 2050 |
| |
2051 | 2051 |
| |
2052 |
| - | |
| 2052 | + | |
2053 | 2053 |
| |
2054 | 2054 |
| |
2055 | 2055 |
| |
| |||
2103 | 2103 |
| |
2104 | 2104 |
| |
2105 | 2105 |
| |
2106 |
| - | |
| 2106 | + | |
2107 | 2107 |
| |
2108 | 2108 |
| |
2109 | 2109 |
| |
|
0 commit comments
Comments
(0)