Re: Add LZ4 compression in pg_dump

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: gkokolatos(at)pm(dot)me
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, shiy(dot)fnst(at)fujitsu(dot)com, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Rachel Heaton <rachelmheaton(at)gmail(dot)com>
Subject: Re: Add LZ4 compression in pg_dump
Date: 2023-03-20 22:40:32
Message-ID: ZBjg4D/X05X+JbcJ@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 17, 2023 at 03:43:58PM +0000, gkokolatos(at)pm(dot)me wrote:
> From a174cdff4ec8aad59f5bcc7e8d52218a14fe56fc Mon Sep 17 00:00:00 2001
> From: Georgios Kokolatos <gkokolatos(at)pm(dot)me>
> Date: Fri, 17 Mar 2023 14:45:58 +0000
> Subject: [PATCH v3 1/3] Improve type handling in pg_dump's compress file API

> -int
> +bool
> EndCompressFileHandle(CompressFileHandle *CFH)
> {
> - int ret = 0;
> + bool ret = 0;

Should say "= false" ?

> /*
> * Write 'size' bytes of data into the file from 'ptr'.
> + *
> + * Returns true on success and false on error.
> + */
> + bool (*write_func) (const void *ptr, size_t size,

> - * Get a pointer to a string that describes an error that occurred during a
> - * compress file handle operation.
> + * Get a pointer to a string that describes an error that occurred during
> + * a compress file handle operation.
> */
> const char *(*get_error_func) (CompressFileHandle *CFH);

This should mention that the error accessible in error_func() applies (only) to
write_func() ?

As long as this touches pg_backup_directory.c you could update the
header comment to refer to "compressed extensions", not just .gz.

I noticed that EndCompressorLZ4() tests "if (LZ4cs)", but that should
always be true.

I was able to convert the zstd patch to this new API with no issue.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-03-20 22:47:20 Re: Ability to reference other extensions by schema in extension scripts
Previous Message Alexander Korotkov 2023-03-20 22:25:11 Re: POC: Lock updated tuples in tuple_update() and tuple_delete()