Hi,
On 2022-08-03 12:01:18 -0500, Justin Pryzby wrote:
> Now, I've reproduced the problem under valgrind, but it doesn't show anything
> useful
Yea, that looks like an issue on a different level.
>
> pryzbyj@pryzbyj:~$ while :; do psql -h /tmp template1 -c "DROP DATABASE a" -c "CREATE DATABASE a TEMPLATE postgres
STRATEGYwal_log"; done
> ERROR: database "a" does not exist
> CREATE DATABASE
> ^CCancel request sent
> ERROR: canceling statement due to user request
> ERROR: database "a" already exists
> ^C
Hm. This looks more like an issue of DROP DATABASE not being interruptible. I
suspect this isn't actually related to STRATEGY wal_log and could likely be
reproduced in older versions too.
It's pretty obvious that dropdb() isn't safe against being interrupted. We
delete the data before we have committed the deletion of the pg_database
entry.
Seems like we should hold interrupts across the remove_dbtablespaces() until
*after* we've committed the transaction?
Greetings,
Andres Freund