codeconsole opened a new issue, #16366:
URL: https://github.com/apache/grails-core/issues/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:
   
   1. **`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.
   
   2. **`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.
   
   3. **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.
   


-- 
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]

Reply via email to