Re: [TODO] Track number of files ready to be archived in pg_stat_archiver - Mailing list pgsql-hackers

From Brightwell, Adam
Subject Re: [TODO] Track number of files ready to be archived in pg_stat_archiver
Date
Msg-id CAKRt6CTygBmvTnS-uue22OcvGs7_oYfz6fyoHmyFX3jJ9jA6=g@mail.gmail.com
Whole thread Raw
In response to Re: [TODO] Track number of files ready to be archived in pg_stat_archiver  (Julien Rouhaud <julien.rouhaud@dalibo.com>)
Responses Re: [TODO] Track number of files ready to be archived in pg_stat_archiver
List pgsql-hackers
Julien,

The following is an initial review:

* Applies cleanly to master (f330a6d).
* Regression tests updated and pass, including 'check-world'.
* Documentation updated and builds successfully.
* Might want to consider replacing the following magic number with a constant or perhaps calculated value.

+       int         basenamelen = (int) strlen(rlde->d_name) - 6;

* Wouldn't it be easier, or perhaps more reliable to use "strrchr()" with the following instead?

+           strcmp(rlde->d_name + basenamelen, ".ready") == 0)

char *extension = strrchr(ride->d_name, '.');
...
strcmp(extension, ".ready") == 0)

I think this approach might also help to resolve the magic number above.  For example:

char *extension = strrchr(ride->d_name, '.');
int basenamelen = (int) strlen(ride->d_name) - strlen(extension);

-Adam

--

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: pg_basebackup fails with long tablespace paths
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: alter user set local_preload_libraries.