cleanup & refactoring on reindexdb.c

Started by Julien Rouhaudalmost 7 years ago6 messageshackers
Jump to latest
#1Julien Rouhaud
rjuju123@gmail.com

Hi,

As discussed in
/messages/by-id/CAOBaU_Yo61RwNO3cW6WVYWwH7EYMPuexhKqufb2nFGOdunbcHw@mail.gmail.com,
current coding in reindexdb.c is error prone, and
reindex_system_catalogs() is also not really required.

I attach two patches to fix both (it could be squashed in a single
commit as both are straightforward), for upcoming v13.

Attachments:

0002-merge_reindex_system_catalogs-v1.difftext/x-patch; charset=US-ASCII; name=0002-merge_reindex_system_catalogs-v1.diffDownload+12-43
0001-use_enum-v1.difftext/x-patch; charset=US-ASCII; name=0001-use_enum-v1.diffDownload+59-36
#2Michael Paquier
michael@paquier.xyz
In reply to: Julien Rouhaud (#1)
Re: cleanup & refactoring on reindexdb.c

On Sun, May 12, 2019 at 11:16:28AM +0200, Julien Rouhaud wrote:

I attach two patches to fix both (it could be squashed in a single
commit as both are straightforward), for upcoming v13.

Squashing both patches together makes the most sense in my opinion as
the same areas are reworked. I can notice that you have applied
pgindent, but the indentation got a bit messed up because the new enum
ReindexType is missing from typedefs.list.

I have reworked a bit your patch as per the attached, tweaking a
couple of places like reordering the elements in ReindexType,
reviewing the indentation, etc. At the end I can see more reasons to
use multiple switch/case points as if we add more options in the
future then we have more code paths to take care of. These would
unlikely get forgotten, but there is no point to take this risk
either, and that would simplify future patches. It is also possible
to group some types together when assigning the object name similarly
to what's on HEAD.
--
Michael

Attachments:

reindex-refactor-v2.patchtext/x-diff; charset=us-asciiDownload+90-75
#3Julien Rouhaud
rjuju123@gmail.com
In reply to: Michael Paquier (#2)
Re: cleanup & refactoring on reindexdb.c

On Mon, May 13, 2019 at 5:09 AM Michael Paquier <michael@paquier.xyz> wrote:

On Sun, May 12, 2019 at 11:16:28AM +0200, Julien Rouhaud wrote:

I attach two patches to fix both (it could be squashed in a single
commit as both are straightforward), for upcoming v13.

Squashing both patches together makes the most sense in my opinion as
the same areas are reworked. I can notice that you have applied
pgindent, but the indentation got a bit messed up because the new enum
ReindexType is missing from typedefs.list.

I have reworked a bit your patch as per the attached, tweaking a
couple of places like reordering the elements in ReindexType,
reviewing the indentation, etc. At the end I can see more reasons to
use multiple switch/case points as if we add more options in the
future then we have more code paths to take care of. These would
unlikely get forgotten, but there is no point to take this risk
either, and that would simplify future patches. It is also possible
to group some types together when assigning the object name similarly
to what's on HEAD.

Thanks! I'm fine with the changes.

The patch does not apply anymore, so here's a rebased version.

Attachments:

reindex-refactor-v3.patchapplication/octet-stream; name=reindex-refactor-v3.patchDownload+90-75
#4Michael Paquier
michael@paquier.xyz
In reply to: Julien Rouhaud (#3)
Re: cleanup & refactoring on reindexdb.c

On Fri, Jun 28, 2019 at 09:25:00AM +0200, Julien Rouhaud wrote:

The patch does not apply anymore, so here's a rebased version.

Thanks for the rebase (and the reminder..). I'll look at that once
v13 opens for business.
--
Michael

#5Michael Paquier
michael@paquier.xyz
In reply to: Michael Paquier (#4)
Re: cleanup & refactoring on reindexdb.c

On Sat, Jun 29, 2019 at 11:24:49AM +0900, Michael Paquier wrote:

Thanks for the rebase (and the reminder..). I'll look at that once
v13 opens for business.

And applied.
--
Michael

#6Julien Rouhaud
rjuju123@gmail.com
In reply to: Michael Paquier (#5)
Re: cleanup & refactoring on reindexdb.c

On Tue, Jul 2, 2019 at 4:44 AM Michael Paquier <michael@paquier.xyz> wrote:

On Sat, Jun 29, 2019 at 11:24:49AM +0900, Michael Paquier wrote:

Thanks for the rebase (and the reminder..). I'll look at that once
v13 opens for business.

And applied.

Thanks!