- Notifications
You must be signed in to change notification settings - Fork5
Commit9b38d46
committed
Make group commit more effective.
When a backend needs to flush the WAL, and someone else is already flushingthe WAL, wait until it releases the WALInsertLock and check if we still needto do the flush or if the other backend already did the work for us, beforeacquiring WALInsertLock. This helps group commit, because when the WAL flushfinishes, all the backends that were waiting for it can be woken up in onego, and the can all concurrently observe that they're done, rather thanwaking them up one by one in a cascading fashion.This is based on a new LWLock function, LWLockWaitUntilFree(), which haspeculiar semantics. If the lock is immediately free, it grabs the lock andreturns true. If it's not free, it waits until it is released, but thenreturns false without grabbing the lock. This is used in XLogFlush(), sothat when the lock is acquired, the backend flushes the WAL, but if it'snot, the backend first checks the current flush location before retrying.Original patch and benchmarking by Peter Geoghegan and Simon Riggs, althoughthis patch as committed ended up being very different from that.1 parentba1868b commit9b38d46
7 files changed
+200
-18
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
330 |
| - | |
| 330 | + | |
331 | 331 |
| |
332 | 332 |
| |
333 | 333 |
| |
|
Lines changed: 29 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2118 | 2118 |
| |
2119 | 2119 |
| |
2120 | 2120 |
| |
2121 |
| - | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
2122 | 2126 |
| |
2123 | 2127 |
| |
2124 | 2128 |
| |
2125 | 2129 |
| |
| 2130 | + | |
2126 | 2131 |
| |
2127 | 2132 |
| |
2128 | 2133 |
| |
2129 | 2134 |
| |
2130 | 2135 |
| |
2131 |
| - | |
2132 | 2136 |
| |
2133 |
| - | |
2134 |
| - | |
2135 |
| - | |
2136 |
| - | |
2137 |
| - | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
2138 | 2158 |
| |
2139 | 2159 |
| |
2140 | 2160 |
| |
| |||
2163 | 2183 |
| |
2164 | 2184 |
| |
2165 | 2185 |
| |
| 2186 | + | |
| 2187 | + | |
2166 | 2188 |
| |
2167 | 2189 |
| |
2168 | 2190 |
| |
|
Lines changed: 160 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
430 | 430 |
| |
431 | 431 |
| |
432 | 432 |
| |
433 |
| - | |
| 433 | + | |
434 | 434 |
| |
435 | 435 |
| |
436 | 436 |
| |
| |||
564 | 564 |
| |
565 | 565 |
| |
566 | 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 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
567 | 705 |
| |
568 | 706 |
| |
569 | 707 |
| |
| |||
618 | 756 |
| |
619 | 757 |
| |
620 | 758 |
| |
621 |
| - | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
622 | 762 |
| |
| 763 | + | |
| 764 | + | |
623 | 765 |
| |
624 |
| - | |
| 766 | + | |
625 | 767 |
| |
626 | 768 |
| |
627 |
| - | |
| 769 | + | |
| 770 | + | |
628 | 771 |
| |
| 772 | + | |
| 773 | + | |
| 774 | + | |
629 | 775 |
| |
630 | 776 |
| |
631 | 777 |
| |
632 | 778 |
| |
633 |
| - | |
634 |
| - | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
635 | 789 |
| |
636 | 790 |
| |
637 | 791 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
362 | 362 |
| |
363 | 363 |
| |
364 | 364 |
| |
365 |
| - | |
| 365 | + | |
366 | 366 |
| |
367 | 367 |
| |
368 | 368 |
| |
| |||
517 | 517 |
| |
518 | 518 |
| |
519 | 519 |
| |
520 |
| - | |
| 520 | + | |
521 | 521 |
| |
522 | 522 |
| |
523 | 523 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
| 39 | + | |
38 | 40 |
| |
39 | 41 |
| |
40 | 42 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
97 |
| - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 |
| |
99 | 102 |
| |
100 | 103 |
| |
| |||
105 | 108 |
| |
106 | 109 |
| |
107 | 110 |
| |
| 111 | + | |
108 | 112 |
| |
109 | 113 |
| |
110 | 114 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
104 |
| - | |
| 104 | + | |
105 | 105 |
| |
106 | 106 |
| |
107 | 107 |
| |
|
0 commit comments
Comments
(0)