forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit951eb8a
Simplify handling of compression level with compression specifications
PG_COMPRESSION_OPTION_LEVEL is removed from the compressionspecification logic, and instead the compression level is alwaysassigned with each library's default if nothing is directly given. Thiscentralizes the checks on the compression methods supported by a givenbuild, and always assigns a default compression level when parsing acompression specification. This results in complaining at an earlierstage than previously if a build supports a compression method or not,aka when parsing a specification in the backend or the frontend, and notwhen processing it. zstd, lz4 and zlib are able to handle in theirrespective routines setting up the compression level the case of adefault value, hence the backend or frontend code (pg_receivewal orpg_basebackup) has now no need to know what the default compressionlevel should be if nothing is specified: the logic is now done so as thespecification parsing assigns it. It can also be enforced by passingdown a "level" set to the default value, that the backend will accept(the replication protocol is for example able to handle a command likeBASE_BACKUP (COMPRESSION_DETAIL 'gzip:level=-1')).This code simplification fixes an issue with pg_basebackup --gzipintroduced byffd5365, where the tarball of the streamed WAL segmentswould be created as of pg_wal.tar.gz with uncompressed contents, whilethe intention is to compress the segments with gzip at a default level.The origin of the confusion comes from the handling of the defaultcompression level of gzip (-1 or Z_DEFAULT_COMPRESSION) and the value of0 was getting assigned, which is what walmethods.c would consideras equivalent to no compression when streaming WAL segments with its tarmethods. Assigning always the compression level removes the confusionof some code paths considering a value of 0 set in a specification aseither no compression or a default compression level.Note that 010_pg_basebackup.pl has to be adjusted to skip a few testswhere the shape of the compression detail string for client andserver-side compression was checked using gzip. This is a result of thecode simplification, as gzip specifications cannot be used if a builddoes not support it.Reported-by: Tom LaneReviewed-by: Tom LaneDiscussion:https://postgr.es/m/1400032.1662217889@sss.pgh.pa.usBackpatch-through: 151 parentf46f2c0 commit951eb8a
File tree
12 files changed
+189
-159
lines changed- doc/src/sgml
- src
- backend/backup
- bin/pg_basebackup
- t
- common
- include/common
12 files changed
+189
-159
lines changedLines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2752 | 2752 |
| |
2753 | 2753 |
| |
2754 | 2754 |
| |
2755 |
| - | |
2756 |
| - | |
2757 |
| - | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
2758 | 2762 |
| |
2759 | 2763 |
| |
2760 | 2764 |
| |
|
Lines changed: 3 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
82 | 78 |
| |
83 | 79 |
| |
84 | 80 |
| |
|
Lines changed: 2 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
| 75 | + | |
| 76 | + | |
82 | 77 |
| |
83 | 78 |
| |
84 | 79 |
| |
|
Lines changed: 5 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
107 | 104 |
| |
108 | 105 |
| |
109 | 106 |
| |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
110 |
| - | |
111 |
| - | |
112 |
| - | |
| 110 | + | |
113 | 111 |
| |
114 | 112 |
| |
115 | 113 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
92 |
| - | |
| 91 | + | |
93 | 92 |
| |
94 | 93 |
| |
95 | 94 |
| |
|
Lines changed: 6 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
84 | 84 |
| |
85 | 85 |
| |
86 | 86 |
| |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
96 | 93 |
| |
97 | 94 |
| |
98 | 95 |
| |
|
Lines changed: 3 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2012 | 2012 |
| |
2013 | 2013 |
| |
2014 | 2014 |
| |
2015 |
| - | |
2016 |
| - | |
2017 |
| - | |
| 2015 | + | |
2018 | 2016 |
| |
2019 | 2017 |
| |
2020 | 2018 |
| |
| |||
2023 | 2021 |
| |
2024 | 2022 |
| |
2025 | 2023 |
| |
2026 |
| - | |
| 2024 | + | |
| 2025 | + | |
2027 | 2026 |
| |
2028 | 2027 |
| |
2029 | 2028 |
| |
|
Lines changed: 4 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
875 | 875 |
| |
876 | 876 |
| |
877 | 877 |
| |
878 |
| - | |
879 |
| - | |
880 |
| - | |
881 |
| - | |
882 |
| - | |
883 |
| - | |
884 |
| - | |
885 |
| - | |
886 |
| - | |
887 |
| - | |
888 |
| - | |
889 |
| - | |
890 |
| - | |
891 |
| - | |
892 |
| - | |
893 |
| - | |
894 |
| - | |
895 |
| - | |
896 |
| - | |
897 |
| - | |
898 |
| - | |
899 |
| - | |
900 |
| - | |
901 |
| - | |
902 |
| - | |
903 |
| - | |
904 |
| - | |
905 |
| - | |
906 |
| - | |
907 |
| - | |
908 |
| - | |
| 878 | + | |
| 879 | + | |
909 | 880 |
| |
| 881 | + | |
| 882 | + | |
910 | 883 |
| |
911 | 884 |
| |
912 | 885 |
| |
|
Lines changed: 72 additions & 62 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
| 89 | + | |
139 | 90 |
| |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 |
| - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
147 | 98 |
| |
148 |
| - | |
149 |
| - | |
150 |
| - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
151 | 102 |
| |
152 |
| - | |
153 |
| - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
154 | 164 |
| |
155 | 165 |
| |
156 | 166 |
| |
|
0 commit comments
Comments
(0)