reshke opened a new pull request, #1908:
URL: https://github.com/apache/cloudberry/pull/1908

   Until now, when DROP DATABASE got interrupted in the wrong moment, the 
removal of the pg_database row would also roll back, even though some 
irreversible steps have already been taken. E.g. DropDatabaseBuffers() might 
have thrown out dirty buffers, or files could have been unlinked. But we 
continued to allow connections to such a corrupted database.
   
   To fix this, mark databases invalid with an in-place update, just before 
starting to perform irreversible steps. As we can't add a new column in the 
back branches, we use pg_database.datconnlimit = -2 for this purpose.
   
   An invalid database cannot be connected to anymore, but can still be dropped.
   
   Unfortunately we can't easily add output to psql's \l to indicate that some 
database is invalid, it doesn't fit in any of the existing columns.
   
   Add tests verifying that a interrupted DROP DATABASE is handled correctly in 
the backend and in various tools.
   
   In cloudberry, we also move segment DDL dispach after pg_database tuple 
transaction commit, otherwise, if killed, segments will already drop thier 
datadirs, while QD not.
   
   Reported-by: Evgeny Morozov <[email protected]>
   Author: Andres Freund <[email protected]>
   Co-authered-by: reshke <[email protected]> (Cloudberry part)
   Reviewed-by: Daniel Gustafsson <[email protected]>
   Reviewed-by: Thomas Munro <[email protected]>
   Discussion: 
https://postgr.es/m/[email protected]
   Discussion: 
https://postgr.es/m/[email protected]
   Backpatch: 11-, bug present in all supported versions
   
   
   This is re-apply of 
https://git.postgresql.org/cgit/postgresql.git/commit/?id=c66a7d75e652801043ece99b6a8f89fd9513eaaa
 with additional cbdb fixes & tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to