forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf1cf641
Fix issues with Windows' stat() for files pending on deletion
The code introduced bybed9075 to enhance the stat() implementation onWindows for file sizes larger than 4GB fails to properly detect filespending for deletion with its method based on NtQueryInformationFile()or GetFileInformationByHandleEx(), as proved by Alexander Lakhin in acustom TAP test of his own.The method used in the implementation of open() to sleep and loop whenwhen failing on ERROR_ACCESS_DENIED (EACCES) is showing much morestability, so switch to this method. This could still lead to issues ifthe permission problem stays around for much longer than the timeout of1 second used, but that should (hopefully) never happen inperformance-critical paths. Still, there could be a point in increasingthe timeouts for the sake of machines that handle heavy loads.Note that WIN32's open() now uses microsoft_native_stat() as it shouldbe similar to stat() when working around issues with concurrent filedeletions.I have spent some time testing this patch with pgbench in combinationof the SQL functions from genfile.c, as well as running the TAP testprovided on the thread with MSVC builds, and this looks much morestable than the previous method.Author: Alexander LakhinReviewed-by: Tom Lane, Michael Paquier,Justin PryzbyDiscussion:https://postgr.es/m/c3427edf-d7c0-ff57-90f6-b5de3bb62709@gmail.comBackpatch-through: 14(cherry picked from commit54fb8c7)Author: Alexandra Wang <alexandra.wang.oss@gmail.com>1 parenta9beed6 commitf1cf641
2 files changed
+51
-126
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 |
| - | |
| 160 | + | |
161 | 161 |
| |
162 |
| - | |
| 162 | + | |
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
|
Lines changed: 49 additions & 124 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 |
| - | |
31 |
| - | |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 |
| - | |
39 |
| - | |
40 |
| - | |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 |
| - | |
45 |
| - | |
46 |
| - | |
47 |
| - | |
48 |
| - | |
49 |
| - | |
50 |
| - | |
51 |
| - | |
52 |
| - | |
53 |
| - | |
54 |
| - | |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 | 21 |
| |
71 | 22 |
| |
72 | 23 |
| |
| |||
165 | 116 |
| |
166 | 117 |
| |
167 | 118 |
| |
168 |
| - | |
169 |
| - | |
170 |
| - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
171 | 122 |
| |
172 | 123 |
| |
173 | 124 |
| |
174 | 125 |
| |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
| 126 | + | |
181 | 127 |
| |
182 | 128 |
| |
183 | 129 |
| |
184 | 130 |
| |
185 | 131 |
| |
186 | 132 |
| |
187 |
| - | |
188 | 133 |
| |
189 | 134 |
| |
190 | 135 |
| |
191 |
| - | |
192 |
| - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
193 | 143 |
| |
194 | 144 |
| |
195 | 145 |
| |
196 | 146 |
| |
197 | 147 |
| |
198 | 148 |
| |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
208 | 157 |
| |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 |
| - | |
214 |
| - | |
| 158 | + | |
215 | 159 |
| |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
224 |
| - | |
225 |
| - | |
226 |
| - | |
227 |
| - | |
228 |
| - | |
229 |
| - | |
230 |
| - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
231 | 177 |
| |
232 |
| - | |
233 |
| - | |
234 |
| - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
235 | 189 |
| |
236 |
| - | |
237 | 190 |
| |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
247 |
| - | |
248 |
| - | |
249 |
| - | |
250 |
| - | |
251 |
| - | |
252 |
| - | |
253 |
| - | |
254 |
| - | |
255 |
| - | |
256 |
| - | |
257 |
| - | |
258 |
| - | |
259 |
| - | |
260 |
| - | |
261 |
| - | |
262 |
| - | |
263 |
| - | |
264 |
| - | |
265 |
| - | |
266 |
| - | |
| 191 | + | |
267 | 192 |
| |
268 | 193 |
| |
269 | 194 |
| |
|
0 commit comments
Comments
(0)