- Notifications
You must be signed in to change notification settings - Fork5
Commit57aa5b2
committed
Add GUC to enable compression of full page images stored in WAL.
When newly-added GUC parameter, wal_compression, is on, the PostgreSQL servercompresses a full page image written to WAL when full_page_writes is on orduring a base backup. A compressed page image will be decompressed during WALreplay. Turning this parameter on can reduce the WAL volume without increasingthe risk of unrecoverable data corruption, but at the cost of some extra CPUspent on the compression during WAL logging and on the decompression duringWAL replay.This commit changes the WAL format (so bumping WAL version number) so thatthe one-byte flag indicating whether a full page image is compressed or not isincluded in its header information. This means that the commit increases theWAL volume one-byte per a full page image even if WAL compression is not usedat all. We can save that one-byte by borrowing one-bit from the existing fieldlike hole_offset in the header and using it as the flag, for example. But whichwould reduce the code readability and the extensibility of the feature.Per discussion, it's not worth paying those prices to save only one-byte, so wedecided to add the one-byte flag to the header.This commit doesn't introduce any new compression algorithm like lz4.Currently a full page image is compressed using the existing PGLZ algorithm.Per discussion, we decided to use it at least in the first version of thefeature because there were no performance reports showing that its compressionratio is unacceptably lower than that of other algorithm. Of course,in the future, it's worth considering the support of other compressionalgorithm for the better compression.Rahila Syed and Michael Paquier, reviewed in various versions by myself,Andres Freund, Robert Haas, Abhijit Menon-Sen and many others.1 parent2fbb286 commit57aa5b2
File tree
11 files changed
+320
-39
lines changed- contrib/pg_xlogdump
- doc/src/sgml
- src
- backend
- access/transam
- utils/misc
- include/access
11 files changed
+320
-39
lines changedLines changed: 20 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
359 | 359 |
| |
360 | 360 |
| |
361 | 361 |
| |
362 |
| - | |
363 |
| - | |
| 362 | + | |
364 | 363 |
| |
365 | 364 |
| |
366 |
| - | |
367 |
| - | |
| 365 | + | |
| 366 | + | |
368 | 367 |
| |
369 | 368 |
| |
370 | 369 |
| |
371 | 370 |
| |
372 | 371 |
| |
373 |
| - | |
| 372 | + | |
374 | 373 |
| |
375 | 374 |
| |
376 | 375 |
| |
| |||
465 | 464 |
| |
466 | 465 |
| |
467 | 466 |
| |
468 |
| - | |
469 |
| - | |
470 |
| - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
471 | 483 |
| |
472 | 484 |
| |
473 | 485 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2282 | 2282 |
| |
2283 | 2283 |
| |
2284 | 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 | + | |
2285 | 2309 |
| |
2286 | 2310 |
| |
2287 | 2311 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
89 | 89 |
| |
90 | 90 |
| |
91 | 91 |
| |
| 92 | + | |
92 | 93 |
| |
93 | 94 |
| |
94 | 95 |
| |
|
Lines changed: 122 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 |
| |
34 | 38 |
| |
35 | 39 |
| |
| |||
50 | 54 |
| |
51 | 55 |
| |
52 | 56 |
| |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 |
| |
54 | 61 |
| |
55 | 62 |
| |
| |||
96 | 103 |
| |
97 | 104 |
| |
98 | 105 |
| |
| 106 | + | |
| 107 | + | |
99 | 108 |
| |
100 | 109 |
| |
101 | 110 |
| |
| |||
482 | 491 |
| |
483 | 492 |
| |
484 | 493 |
| |
| 494 | + | |
485 | 495 |
| |
| 496 | + | |
| 497 | + | |
| 498 | + | |
486 | 499 |
| |
487 | 500 |
| |
488 | 501 |
| |
| |||
529 | 542 |
| |
530 | 543 |
| |
531 | 544 |
| |
| 545 | + | |
532 | 546 |
| |
533 | 547 |
| |
534 |
| - | |
| 548 | + | |
| 549 | + | |
535 | 550 |
| |
536 | 551 |
| |
537 | 552 |
| |
| |||
543 | 558 |
| |
544 | 559 |
| |
545 | 560 |
| |
546 |
| - | |
547 |
| - | |
| 561 | + | |
| 562 | + | |
548 | 563 |
| |
549 | 564 |
| |
550 | 565 |
| |
551 | 566 |
| |
552 |
| - | |
553 |
| - | |
| 567 | + | |
| 568 | + | |
554 | 569 |
| |
555 | 570 |
| |
556 | 571 |
| |
557 | 572 |
| |
558 | 573 |
| |
559 |
| - | |
560 |
| - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
561 | 587 |
| |
562 | 588 |
| |
563 | 589 |
| |
564 | 590 |
| |
565 | 591 |
| |
566 |
| - | |
567 |
| - | |
568 | 592 |
| |
569 | 593 |
| |
570 | 594 |
| |
571 | 595 |
| |
572 | 596 |
| |
573 |
| - | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
574 | 601 |
| |
575 |
| - | |
576 |
| - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
577 | 610 |
| |
578 | 611 |
| |
579 | 612 |
| |
580 |
| - | |
581 |
| - | |
582 |
| - | |
| 613 | + | |
| 614 | + | |
583 | 615 |
| |
584 |
| - | |
585 |
| - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
586 | 626 |
| |
587 |
| - | |
588 |
| - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
589 | 633 |
| |
| 634 | + | |
| 635 | + | |
590 | 636 |
| |
591 | 637 |
| |
592 | 638 |
| |
| |||
619 | 665 |
| |
620 | 666 |
| |
621 | 667 |
| |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
622 | 674 |
| |
623 | 675 |
| |
624 | 676 |
| |
| |||
680 | 732 |
| |
681 | 733 |
| |
682 | 734 |
| |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
683 | 786 |
| |
684 | 787 |
| |
685 | 788 |
| |
|
0 commit comments
Comments
(0)