- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit6b93fcd
committed
Avoid atomic operation in MarkLocalBufferDirty().
The recent patch to make Pin/UnpinBuffer lockfree in the hotpath (4835458), accidentally used pg_atomic_fetch_or_u32() inMarkLocalBufferDirty(). Other code operating on local buffers wascareful to only use pg_atomic_read/write_u32 which just read/write frommemory; to avoid unnecessary overhead.On its own that'd just make MarkLocalBufferDirty() slightly lessefficient, but in addition InitLocalBuffers() doesn't callpg_atomic_init_u32() - thus the spinlock fallback for the atomicoperations isn't initialized. That in turn caused, as reported by Tom,buildfarm animal gaur to fail. As those errors are actually usefulagainst this type of error, continue to omit - intentionally this time -initialization of the atomic variable.In addition, add an explicit note about only using pg_atomic_read/writeon local buffers's state to BufferDesc's description.Reported-By: Tom LaneDiscussion: 1881.1460431476@sss.pgh.pa.us1 parent95ef43c commit6b93fcd
File tree
2 files changed
+16
-3
lines changed- src
- backend/storage/buffer
- include/storage
2 files changed
+16
-3
lines changedLines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
294 | 294 |
| |
295 | 295 |
| |
296 | 296 |
| |
297 |
| - | |
| 297 | + | |
298 | 298 |
| |
299 | 299 |
| |
300 | 300 |
| |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
301 | 305 |
| |
302 | 306 |
| |
303 | 307 |
| |
| |||
431 | 435 |
| |
432 | 436 |
| |
433 | 437 |
| |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
434 | 445 |
| |
435 | 446 |
| |
436 | 447 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
169 |
| - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
170 | 172 |
| |
171 | 173 |
| |
172 | 174 |
| |
|
0 commit comments
Comments
(0)