Re: ArchiveEntry optional arguments refactoring

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: ArchiveEntry optional arguments refactoring
Date: 2019-01-16 12:18:06
Message-ID: CA+q6zcXG-aL7aw7A4Mp20yMv_OsOW9dESNyUwuPqe0Z02FGoTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Wed, Jan 16, 2019 at 1:16 PM Dmitry Dolgov <9erthalion6(at)gmail(dot)com> wrote:
>
> Hi,
>
> During the discussion in [1] an idea about refactoring ArchiveEntry was
> suggested. The reason is that currently this function has significant number of
> arguments that are "optional", and every change that has to deal with it
> introduces a lot of useless diffs. In the thread, mentioned above, such an
> example is tracking current table access method, and I guess "Remove WITH OIDS"
> commit 578b229718e is also similar.
>
> Proposed idea is to refactor out all/optional arguments into a separate data
> structure, so that adding/removing a new argument wouldn't change that much of
> unrelated code. Then for every invocation of ArchiveEntry this structure needs
> to be prepared before the call, or as Andres suggested:
>
> ArchiveEntry((ArchiveArgs){.tablespace = 3,
> .dumpFn = somefunc,
> ...});
>
> Another suggestion from Amit is to have an ArchiveEntry() function with limited
> number of parameters, and an ArchiveEntryEx() with those extra parameters which
> are not needed in usual cases.
>
> I want to prepare a patch for that, and I'm inclined to go with the first
> option, but since there are two solutions to choose from, I would love to hear
> more opinion about this topic. Any pros/cons we don't see yet?
>
> [1]: https://www.postgresql.org/message-id/flat/20180703070645.wchpu5muyto5n647%40alap3.anarazel.de

[CC Andres and Amit]

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2019-01-16 12:47:06 jsonb_set for an array with an index outside of boundaries
Previous Message Dmitry Dolgov 2019-01-16 12:16:40 ArchiveEntry optional arguments refactoring