File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,32 @@ pub(crate) async fn mirror_root_inode(
267267 } ) ?;
268268
269269 if clients > 0 {
270- bail ! ( "This operation requires that all clients are disconnected/unmounted, but still has {clients} clients mounted." ) ;
270+ bail ! (
271+ "This operation requires that all clients are disconnected/unmounted. \
272+ {clients} clients are still mounted."
273+ ) ;
274+ }
275+
276+ let mut server_stmt = tx. prepare ( sql ! (
277+ "SELECT COUNT(*) FROM nodes
278+ WHERE node_type = ?1 AND UNIXEPOCH('now') - UNIXEPOCH(last_contact) < 180
279+ AND node_uid != ?2"
280+ ) ) ?;
281+
282+ let metas = server_stmt. query_row ( [ NodeType :: Meta . sql_variant ( ) , node_uid] , |row| {
283+ row. get :: < _ , i64 > ( 0 )
284+ } ) ?;
285+ let storages = server_stmt
286+ . query_row ( [ NodeType :: Storage . sql_variant ( ) , node_uid] , |row| {
287+ row. get :: < _ , i64 > ( 0 )
288+ } ) ?;
289+
290+ if metas > 0 || storages > 0 {
291+ bail ! (
292+ "This operation requires that all nodes except the root meta node are shut \
293+ down. {metas} meta nodes (excluding the root meta node) and {storages} storage nodes have \
294+ communicated during the last 180s."
295+ ) ;
271296 }
272297
273298 Ok ( node_uid)
You can’t perform that action at this time.
0 commit comments