forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbabbbb5
committed
Add support for LZ4 compression in pg_receivewal
pg_receivewal gains a new option, --compression-method=lz4, availablewhen the code is compiled with --with-lz4. Similarly to gzip, thisgives the possibility to compress archived WAL segments with LZ4. Thisoption is not compatible with --compress.The implementation uses LZ4 frames, and is compatible with simple lz4commands. Like gzip, using --synchronous ensures that any data will beflushed to disk within the current .partial segment, so as it ispossible to retrieve as much WAL data as possible even from anon-completed segment (this requires completing the partial file withzeros up to the WAL segment size supported by the backend afterdecompression, but this is the same as gzip).The calculation of the streaming start LSN is able to transparently findand check LZ4-compressed segments. Contrary to gzip where theuncompressed size is directly stored in the object read, the LZ4 chunkprotocol does not store the uncompressed data by default. There iscontentSize that can be used with LZ4 frames by that would not help ifusing an archive that includes segments compressed with the defaults ofa "lz4" command, where this is not stored. So, this commit has takenthe most extensible approach by decompressing the already-archivedsegment to check its uncompressed size, through a blank output buffer inchunks of 64kB (no actual performance difference noticed with 8kB, 16kBor 32kB, and the operation in itself is actually fast).Tests have been added to verify the creation and correctness of thegenerated LZ4 files. The latter is achieved by the use of command"lz4", if found in the environment.The tar-based WAL method in walmethods.c, used now only bypg_basebackup, does not know yet about LZ4. Its code could be extendedfor this purpose.Author: Georgios KokolatosReviewed-by: Michael Paquier, Jian Guo, Magnus Hagander, Dilip KumarDiscussion:https://postgr.es/m/ZCm1J5vfyQ2E6dYvXz8si39HQ2gwxSZ3IpYaVgYa3lUwY88SLapx9EEnOf5uEwrddhx2twG7zYKjVeuP5MwZXCNPybtsGouDsAD1o2L_I5E=@pm.me1 parent5cd7eb1 commitbabbbb5
File tree
7 files changed
+388
-13
lines changed- doc/src/sgml/ref
- src
- bin/pg_basebackup
- t
7 files changed
+388
-13
lines changedLines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
268 | 268 |
| |
269 | 269 |
| |
270 | 270 |
| |
271 |
| - | |
272 |
| - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
273 | 274 |
| |
274 | 275 |
| |
275 | 276 |
| |
276 | 277 |
| |
277 |
| - | |
| 278 | + | |
| 279 | + | |
278 | 280 |
| |
279 | 281 |
| |
280 | 282 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
350 | 350 |
| |
351 | 351 |
| |
352 | 352 |
| |
| 353 | + | |
353 | 354 |
| |
354 | 355 |
| |
355 | 356 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
|
Lines changed: 157 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 |
| |
36 | 40 |
| |
37 | 41 |
| |
| |||
136 | 140 |
| |
137 | 141 |
| |
138 | 142 |
| |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
139 | 152 |
| |
140 | 153 |
| |
141 | 154 |
| |
| |||
154 | 167 |
| |
155 | 168 |
| |
156 | 169 |
| |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
157 | 179 |
| |
158 | 180 |
| |
159 | 181 |
| |
| |||
278 | 300 |
| |
279 | 301 |
| |
280 | 302 |
| |
281 |
| - | |
| 303 | + | |
282 | 304 |
| |
283 | 305 |
| |
284 | 306 |
| |
285 | 307 |
| |
286 | 308 |
| |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
287 | 317 |
| |
288 | 318 |
| |
289 | 319 |
| |
| |||
350 | 380 |
| |
351 | 381 |
| |
352 | 382 |
| |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
353 | 491 |
| |
354 | 492 |
| |
355 | 493 |
| |
| |||
650 | 788 |
| |
651 | 789 |
| |
652 | 790 |
| |
| 791 | + | |
| 792 | + | |
653 | 793 |
| |
654 | 794 |
| |
655 | 795 |
| |
| |||
746 | 886 |
| |
747 | 887 |
| |
748 | 888 |
| |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
749 | 905 |
| |
750 | 906 |
| |
751 | 907 |
| |
|
Lines changed: 64 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
| 8 | + | |
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
| |||
138 | 138 |
| |
139 | 139 |
| |
140 | 140 |
| |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
141 | 197 |
| |
142 |
| - | |
| 198 | + | |
143 | 199 |
| |
144 | 200 |
| |
145 | 201 |
| |
146 | 202 |
| |
147 |
| - | |
| 203 | + | |
148 | 204 |
| |
149 | 205 |
| |
150 | 206 |
| |
151 | 207 |
| |
152 | 208 |
| |
153 | 209 |
| |
154 | 210 |
| |
155 |
| - | |
| 211 | + | |
156 | 212 |
| |
157 | 213 |
| |
158 | 214 |
| |
| |||
190 | 246 |
| |
191 | 247 |
| |
192 | 248 |
| |
193 |
| - | |
| 249 | + | |
194 | 250 |
| |
195 | 251 |
| |
196 | 252 |
| |
197 | 253 |
| |
198 | 254 |
| |
199 | 255 |
| |
200 | 256 |
| |
201 |
| - | |
| 257 | + | |
202 | 258 |
| |
203 | 259 |
| |
204 | 260 |
| |
| |||
253 | 309 |
| |
254 | 310 |
| |
255 | 311 |
| |
256 |
| - | |
| 312 | + | |
257 | 313 |
| |
258 | 314 |
| |
259 | 315 |
| |
260 | 316 |
| |
261 | 317 |
| |
262 |
| - | |
| 318 | + | |
263 | 319 |
| |
264 | 320 |
| |
265 | 321 |
| |
|
0 commit comments
Comments
(0)