Re: refactoring basebackup.c

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: refactoring basebackup.c
Дата
Msg-id CA+Tgmoat7JFnq0_WrSDjFxNU3uVaj-Z425Av-fujs5ND+i3hXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: refactoring basebackup.c  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: refactoring basebackup.c  (Dipesh Pandit <dipesh.pandit@gmail.com>)
Список pgsql-hackers
On Thu, Jan 20, 2022 at 11:10 AM Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, Jan 20, 2022 at 8:00 AM Dipesh Pandit <dipesh.pandit@gmail.com> wrote:
> > Thanks for the feedback, I have incorporated the suggestions and
> > updated a new patch v2.
>
> Cool. I'll do a detailed review later, but I think this is going in a
> good direction.

Here is a more detailed review.

+    if (inflateInit2(zs, 15 + 16) != Z_OK)
+    {
+        pg_log_error("could not initialize compression library");
+        exit(1);
+
+    }

Extra blank line.

+    /* At present, we only know how to parse tar and gzip archives. */

gzip -> tar.gz. You can gzip something that is not a tar.

+     * Extract the gzip compressed archive using a gzip extractor and then
+     * forward it to next streamer.

This comment is not good. First, we're not necessarily doing it.
Second, it just describes what the code does, not why it does it.
Maybe something like "If the user requested both that the server
compress the backup and also that we extract the backup, we need to
decompress it."

+    if (server_compression != NULL)
+    {
+        if (strcmp(server_compression, "gzip") == 0)
+            server_compression_type = BACKUP_COMPRESSION_GZIP;
+        else if (strlen(server_compression) == 5 &&
+                strncmp(server_compression, "gzip", 4) == 0 &&
+                server_compression[4] >= '1' && server_compression[4] <= '9')
+        {
+            server_compression_type = BACKUP_COMPRESSION_GZIP;
+            server_compression_level = server_compression[4] - '0';
+        }
+    }
+    else
+        server_compression_type = BACKUP_COMPRESSION_NONE;

I think this is not required any more. I think probably some other
things need to be adjusted as well, based on Michael's changes and the
updates in my patch to match.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Replace uses of deprecated Python module distutils.sysconfig
Следующее
От: Andres Freund
Дата:
Сообщение: Re: A test for replay of regression tests