- Notifications
You must be signed in to change notification settings - Fork5
Commitb966dd6
committed
Add fsync capability to initdb, and use sync_file_range() if available.
Historically we have not worried about fsync'ing anything during initdb(in fact, initdb intentionally passes -F to each backend launch to preventit from fsync'ing). But with filesystems getting more aggressive aboutcaching data, that's not such a good plan anymore. Make initdb do a passover the finished data directory tree to fsync everything. For testingpurposes, the -N/--nosync flag can be used to restore the old behavior.Also, testing shows that on Linux, sync_file_range() is much faster thanposix_fadvise() for hinting to the kernel that an fsync is coming,apparently because the latter blocks on a rather small request queue whilethe former doesn't. So use this function if available in initdb, and alsoin the backend's pg_flush_data() (where it currently will affect only thespeed of CREATE DATABASE's cloning step).We will later make pg_regress invoke initdb with the --nosync flagto avoid slowing down cases such as "make check" in contrib. Butlet's not do so until we've shaken out any portability issues in thispatch.Jeff Davis, reviewed by Andres Freund1 parent1a9405d commitb966dd6
File tree
7 files changed
+258
-5
lines changed- doc/src/sgml/ref
- src
- backend/storage/file
- bin/initdb
- include
7 files changed
+258
-5
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19254 | 19254 |
| |
19255 | 19255 |
| |
19256 | 19256 |
| |
19257 |
| - | |
| 19257 | + | |
| 19258 | + | |
19258 | 19259 |
| |
19259 | 19260 |
| |
19260 | 19261 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1207 | 1207 |
| |
1208 | 1208 |
| |
1209 | 1209 |
| |
1210 |
| - | |
| 1210 | + | |
1211 | 1211 |
| |
1212 | 1212 |
| |
1213 | 1213 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
219 | 219 |
| |
220 | 220 |
| |
221 | 221 |
| |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
222 | 237 |
| |
223 | 238 |
| |
224 | 239 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
336 | 336 |
| |
337 | 337 |
| |
338 | 338 |
| |
339 |
| - | |
| 339 | + | |
| 340 | + | |
340 | 341 |
| |
341 | 342 |
| |
342 | 343 |
| |
343 | 344 |
| |
344 |
| - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
345 | 348 |
| |
346 | 349 |
| |
347 | 350 |
| |
|
Lines changed: 229 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
| 52 | + | |
52 | 53 |
| |
53 | 54 |
| |
54 | 55 |
| |
| |||
116 | 117 |
| |
117 | 118 |
| |
118 | 119 |
| |
| 120 | + | |
119 | 121 |
| |
120 | 122 |
| |
121 | 123 |
| |
| |||
160 | 162 |
| |
161 | 163 |
| |
162 | 164 |
| |
| 165 | + | |
| 166 | + | |
| 167 | + | |
163 | 168 |
| |
164 | 169 |
| |
165 | 170 |
| |
| |||
182 | 187 |
| |
183 | 188 |
| |
184 | 189 |
| |
| 190 | + | |
| 191 | + | |
| 192 | + | |
185 | 193 |
| |
186 | 194 |
| |
187 | 195 |
| |
| |||
209 | 217 |
| |
210 | 218 |
| |
211 | 219 |
| |
| 220 | + | |
212 | 221 |
| |
213 | 222 |
| |
214 | 223 |
| |
| |||
489 | 498 |
| |
490 | 499 |
| |
491 | 500 |
| |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
492 | 669 |
| |
493 | 670 |
| |
494 | 671 |
| |
| |||
2092 | 2269 |
| |
2093 | 2270 |
| |
2094 | 2271 |
| |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
2095 | 2313 |
| |
2096 | 2314 |
| |
2097 | 2315 |
| |
| |||
2532 | 2750 |
| |
2533 | 2751 |
| |
2534 | 2752 |
| |
| 2753 | + | |
2535 | 2754 |
| |
2536 | 2755 |
| |
2537 | 2756 |
| |
| |||
2621 | 2840 |
| |
2622 | 2841 |
| |
2623 | 2842 |
| |
| 2843 | + | |
2624 | 2844 |
| |
2625 | 2845 |
| |
2626 | 2846 |
| |
| |||
2676 | 2896 |
| |
2677 | 2897 |
| |
2678 | 2898 |
| |
2679 |
| - | |
| 2899 | + | |
2680 | 2900 |
| |
2681 | 2901 |
| |
2682 | 2902 |
| |
| |||
2719 | 2939 |
| |
2720 | 2940 |
| |
2721 | 2941 |
| |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
2722 | 2945 |
| |
2723 | 2946 |
| |
2724 | 2947 |
| |
| |||
3310 | 3533 |
| |
3311 | 3534 |
| |
3312 | 3535 |
| |
| 3536 | + | |
| 3537 | + | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
3313 | 3541 |
| |
3314 | 3542 |
| |
3315 | 3543 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
511 | 511 |
| |
512 | 512 |
| |
513 | 513 |
| |
| 514 | + | |
| 515 | + | |
| 516 | + | |
514 | 517 |
| |
515 | 518 |
| |
516 | 519 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
| 423 | + | |
| 424 | + | |
| 425 | + | |
423 | 426 |
| |
424 | 427 |
| |
425 | 428 |
| |
|
0 commit comments
Comments
(0)