forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9cb91f9
committed
Fix two race conditions between the pending unlink mechanism that was put in
place to prevent reusing relation OIDs before next checkpoint, and DROPDATABASE. First, if a database was dropped, bgwriter would still try to unlinkthe files that the rmtree() call by the DROP DATABASE command has alreadydeleted, or is just about to delete. Second, if a database is dropped, andanother database is created with the same OID, bgwriter would in the worstcase delete a relation in the new database that happened to get the same OIDas a dropped relation in the old database.To fix these race conditions:- make rmtree() ignore ENOENT errors. This fixes the 1st race condition.- make ForgetDatabaseFsyncRequests forget unlink requests as well.- force checkpoint on in dropdb on all platformsSince ForgetDatabaseFsyncRequests() is asynchronous, the 2nd change isn'tenough on its own to fix the problem of dropping and creating a database withsame OID, but forcing a checkpoint on DROP DATABASE makes it sufficient.Per Tom Lane's bug report and proposal. Backpatch to 8.3.1 parent87a2f05 commit9cb91f9
File tree
3 files changed
+59
-15
lines changed- src
- backend
- commands
- storage/smgr
- port
3 files changed
+59
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
718 | | - | |
719 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
720 | 722 | | |
721 | 723 | | |
722 | 724 | | |
723 | 725 | | |
724 | | - | |
725 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
726 | 730 | | |
727 | | - | |
728 | 731 | | |
729 | | - | |
730 | 732 | | |
731 | 733 | | |
732 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
1196 | 1196 | | |
1197 | 1197 | | |
1198 | 1198 | | |
1199 | | - | |
1200 | | - | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1201 | 1204 | | |
1202 | 1205 | | |
1203 | 1206 | | |
| |||
1321 | 1324 | | |
1322 | 1325 | | |
1323 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
1324 | 1330 | | |
| 1331 | + | |
1325 | 1332 | | |
1326 | 1333 | | |
1327 | 1334 | | |
| |||
1331 | 1338 | | |
1332 | 1339 | | |
1333 | 1340 | | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1334 | 1357 | | |
1335 | 1358 | | |
1336 | 1359 | | |
| |||
1386 | 1409 | | |
1387 | 1410 | | |
1388 | 1411 | | |
1389 | | - | |
| 1412 | + | |
1390 | 1413 | | |
1391 | 1414 | | |
1392 | 1415 | | |
| |||
1419 | 1442 | | |
1420 | 1443 | | |
1421 | 1444 | | |
1422 | | - | |
| 1445 | + | |
1423 | 1446 | | |
1424 | 1447 | | |
1425 | 1448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
409 | 420 | | |
410 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
411 | 427 | | |
412 | 428 | | |
413 | 429 | | |
| |||
422 | 438 | | |
423 | 439 | | |
424 | 440 | | |
425 | | - | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
426 | 445 | | |
427 | 446 | | |
428 | 447 | | |
| |||
0 commit comments
Comments
(0)