Refactoring of compression options in pg_basebackup
От | Michael Paquier |
---|---|
Тема | Refactoring of compression options in pg_basebackup |
Дата | |
Msg-id | Yb3GEgWwcu4wZDuA@paquier.xyz обсуждение исходный текст |
Ответы |
Re: Refactoring of compression options in pg_basebackup
Re: Refactoring of compression options in pg_basebackup |
Список | pgsql-hackers |
Hi all, (Added Georgios in CC.) When working on the support of LZ4 for pg_receivewal, walmethods.c has gained an extra parameter for the compression method. It gets used on the DirectoryMethod instead of the compression level to decide which type of compression is used. One thing that I left out during this previous work is that the TarMethod also gained knowledge of this compression method, but we still use the compression level to check if tars should be compressed or not. This is wrong on multiple aspects. First, this is not consistent with the directory method, making walmethods.c harder to figure out. Second, this is not extensible if we want to introduce more compression methods in pg_basebackup, like LZ4. This reflects on the options used by pg_receivewal and pg_basebackup, that are not inconsistent as well. The attached patch refactors the code of pg_basebackup and the TarMethod of walmethods.c to use the compression method where it should, splitting entirely the logic related the compression level. This is one step toward the introduction of LZ4 in pg_basebackup, but this refactoring is worth doing on its own, hence a separate thread to deal with this problem first. The options of pg_basebackup are reworked to be consistent with pg_receivewal, as follows: - --compress ranges now from 1 to 9, instead of 0 to 9. - --compression-method={none,gzip} is added, the default is none, same as HEAD. - --gzip/-z has the same meaning as before, being just a synonym of --compression-method=gzip with the default compression level of ZLIB assigned if there is no --compress. One more thing that I have noticed while hacking this stuff is that we have no regression tests for gzip with pg_basebackup, so I have added some that are skipped when not compiling the code with ZLIB. Opinions? -- Michael
Вложения
В списке pgsql-hackers по дате отправления: