Re: Add pg_file_sync() to adminpack

Michael Paquier <[email protected]> Mon, 13 Jan 2020 22:46:00 +0900
Newsgroups gmane.comp.db.postgresql.devel.general
Message-ID <[email protected]>
On Sat, Jan 11, 2020 at 02:12:15AM +0900, Fujii Masao wrote:
> I'm not sure if returning false with WARNING only in some error cases
> is really good idea or not. At least for me, it's more intuitive to
> return true on success and emit an ERROR otherwise. I'd like to hear
> more opinions about this. Also if returning true on success is rather
> confusing, we can change its return type to void.

An advantage of not issuing an ERROR if that when working on a list of
files (for example a WITH RECURSIVE on the whole data directory?), you
can then know which files could not be synced instead of seeing one
ERROR about one file, while being unsure about the state of the
others.

> Could you elaborate why? But if it's not good to sync the existing directory
> in the regression test, we may need to give up testing the sync of directory.
> Another idea is to add another function like pg_mkdir() into adminpack
> and use the directory that we newly created by using that function,
> for the test. Or better idea?

We should avoid potentially costly tests in any regression scenario if
we have a way to do so.  I like your idea of having a pg_mkdir(), that
feels more natural to have as there is already pg_file_write().
--
Michael
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4cdJgACgkQnvQgOdby
QH2DbQ//fG1VjUlMAaENWv0C49lp54FFVx6/0Ei1DwvyQDgEw9kLXf9i/SeGou4k
tIxj2d6KHy/MKcU0vmjxvutaV0jEul0PUyMeaOV/QHa/L6LcN7YjrkoiBrYj2Rxl
c8/bI071cxZzeGm9BpPxlJTsCF4P+2I9h+ISL5jW44JpDbHjkWP/q3+pCy0qYKNt
OMhsCvf/lkAADyhxthL4JIVOlACmn9jUwlv8K7ahlsYz10uiG1+YT/Vjxhrggbvz
85pucbz7f651oAecaTPExAMS11x7ih/PCXbHcYYPo0Cz8R8/xmX1kY6vXRDXu0Gw
g0JnI6yOEJPBDfC6O3he+iZsBFQ/j3Ond8JgWm82BMGzyYfmxPz0JIx8qSkHiRkd
0bF5Y3JwV5kCj3BxTX6w1mW5PgfEZyN92sBarxONsWgoIhRzSV3tXZPJBwOok0MU
2hgF7KY0+E7G/ARQwekdi43Q4rcKHOJnoc4F+oin2QybrrBNDtTNfAlcq+B9BnKJ
+ylPuXOWNjdpSU5dPyH7DaADTzaiGI+XVDyn1O6wR/OzL66y3X5i4S0Ihcgw9cIL
TXvaqp5ML34bcRIi6EBV4YylWldY8CUsiBH+hhyHDHkw+o2lVXbQg04ZhpIZRB5n
0z6Fhlotq5WVQgeAQM+66EEuDf6vtPwV9seaSdx52uGhcjp66Z8=
=SPx2
-----END PGP SIGNATURE-----