Hi Tom,
I've updated the patch by adding the explanation behind and more comments. (please see the attachment)
Have slightly improved the logic so that it does not report an error
"directory \"%s\" exists but is not empty"
when it is only supposed to warn the user about the mountpoint, without exiting.
To me, my patch looks like a typo fix where exit(1) should not be called on the warn_on_mount_point(),
but only warn and continue as more people are mounting the device at `/var/lib/postgresql/data` (PGDATA) in the
containerizedworld (K8s deployments, especially now in the Akash Network I am working for) for making sure their data
persist.
As a workaround, we either have to `rmdir /var/lib/postgresql/data/lost+found` before running `docker-entrypoint.sh
postgres`which in turn calls the `initdb`, or, alternatively we have to pass
`PGDATA=/var/lib/postgresql/data/<something>`while mounting persistent storage over `/var/lib/postgresql/data` path so
thatit won't exit on the very first run.
To me, this in itself is an odd behavior, which led me to finding this typo (from my point of view) to which I've made
thispatch.
Please let me know if it makes sense or requires more information / explanation.
Kind regards,
Andrey Arapov
September 10, 2022 5:10 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
> andrey.arapov@nixaid.com writes:
>
>> please find my first patch for PostgreSQL is attached.
>
> You haven't explained why you think this would be a good
> change, or even a safe one.
>
> regards, tom lane