status: Display number of currently connected clients, and whether new clients are allowed
These will be useful for migration status monitoring - replaces "is pass == 7?"
This commit is contained in:
@@ -12,6 +12,9 @@ struct status * status_create( struct server * serve )
|
||||
status->size = serve->size;
|
||||
status->has_control = serve->success;
|
||||
|
||||
status->clients_allowed = serve->allow_new_clients;
|
||||
status->num_clients = server_count_clients( serve );
|
||||
|
||||
server_lock_start_mirror( serve );
|
||||
|
||||
status->is_mirroring = NULL != serve->mirror;
|
||||
@@ -51,6 +54,8 @@ int status_write( struct status * status, int fd )
|
||||
PRINT_INT( pid );
|
||||
PRINT_UINT64( size );
|
||||
PRINT_BOOL( is_mirroring );
|
||||
PRINT_BOOL( clients_allowed );
|
||||
PRINT_INT( num_clients );
|
||||
PRINT_BOOL( has_control );
|
||||
|
||||
if ( status->is_mirroring ) {
|
||||
|
10
src/status.h
10
src/status.h
@@ -30,6 +30,14 @@
|
||||
* If the server is started in "serve" mode, this will never be
|
||||
* false.
|
||||
*
|
||||
* clients_allowed:
|
||||
* This will be false if the server is not currently allowing new
|
||||
* connections, for instance, if we're in the migration endgame.
|
||||
*
|
||||
* num_clients:
|
||||
* This tells us how many clients are currently running. If we're in the
|
||||
* migration endgame, it should be 0
|
||||
*
|
||||
* is_migrating:
|
||||
* This will be false when the server is started in either "listen"
|
||||
* or "serve" mode. It will become true when a server in "serve"
|
||||
@@ -73,6 +81,8 @@ struct status {
|
||||
pid_t pid;
|
||||
uint64_t size;
|
||||
int has_control;
|
||||
int clients_allowed;
|
||||
int num_clients;
|
||||
int is_mirroring;
|
||||
int migration_pass;
|
||||
uint64_t pass_dirty_bytes;
|
||||
|
Reference in New Issue
Block a user