forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5406513
committed
In pgwin32_open, loop after ERROR_ACCESS_DENIED only if we can't stat.
This fixes a performance problem introduced by commit6d7547c.ERROR_ACCESS_DENIED is returned in some other cases besides thedelete-pending case considered by that commit; notably, if thegiven path names a directory instead of a plain file. In thatcase we'll uselessly loop for 1 second before returning thefailure condition. That slows down some usage scenarios enoughto cause test timeout failures on our Windows buildfarm critters.To fix, try to stat() the file, and sleep/loop only if that fails.It will fail in the delete-pending case, and also in the case wherethe deletion completed before we could stat(), so we have the caseswhere we want to loop covered. In the directory case, the stat()should succeed, letting us exit without a wait.One case where we'll still wait uselessly is if the access-deniedproblem pertains to a directory in the given pathname. But we don'texpect that to happen in any performance-critical code path.There might be room to refine this further, but I'll push it nowin hopes of making the buildfarm green again.Back-patch, like the preceding commit.Alexander Lakhin and Tom LaneDiscussion:https://postgr.es/m/23073.1576626626@sss.pgh.pa.us1 parent4376fdb commit5406513
1 file changed
+23
-7
lines changedLines changed: 23 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| 24 | + | |
24 | 25 |
| |
25 | 26 |
| |
26 | 27 |
| |
| |||
137 | 138 |
| |
138 | 139 |
| |
139 | 140 |
| |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
144 | 155 |
| |
145 | 156 |
| |
146 | 157 |
| |
147 | 158 |
| |
148 | 159 |
| |
149 |
| - | |
150 |
| - | |
151 |
| - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
152 | 168 |
| |
153 | 169 |
| |
154 | 170 |
| |
|
0 commit comments
Comments
(0)