You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MongoDB CRaC checkpoint and restore cover only the default connection #16366
MongoDatastore.stop() and start() (#16095) let an application take a CRaC checkpoint: stop() closes the MongoClient, because CRaC refuses to checkpoint a process holding open sockets, and start() builds a replacement after the restore. Both only cover the default connection. Three gaps, all predating #16208, where @jdaugherty found them during review:
stop() leaves the named connections' clients open. It closes only the default connection's client. Each connection under grails.mongodb.connections has a child datastore with a client of its own, and none of them is closed, so a checkpoint of an application with named connections still sees their sockets.
start() rebuilds only the default connection's client. Fixing the first gap also needs the children's clients replaced on restore, and anything holding a child's client has to pick up the replacement.
SCHEMA multi-tenancy keeps resolving tenants through the pre-checkpoint client. The AllTenantsResolver built in the MongoDatastore constructor lists tenant ids with defaultConnectionSource.getSource().listDatabaseNames(), the client the connection source was created with, rather than getMongoClient(). After a restore that is the client stop() closed, so eachTenant, and anything else that resolves all tenants, runs against a closed client.
For reference, #16208 makes stop() and start() interrupt and resume the background index build (grails.mongodb.buildIndexesAsync) on every connection, but deliberately leaves the clients themselves as they are, since that belongs here.
Activity
Close and replace every MongoDB client across a CRaC checkpoint