From c906747d52c08588cdace0f92480b533f87ca95f Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Fri, 25 Feb 2011 10:33:12 +1100 Subject: [PATCH] ATTACH_DB: simplify the code slightly and change the semantics to only refuse a db attach during recovery IF we can associate the request from a genuine real client instead of deciding this on whether client_id is zero or This will suppress/avoid messages like these : DB Attach to database %s refused. Can not match clientid... --- server/ctdb_ltdb_server.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c index 07fdec0d..19a68ec7 100644 --- a/server/ctdb_ltdb_server.c +++ b/server/ctdb_ltdb_server.c @@ -805,6 +805,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, const char *db_name = (const char *)indata.dptr; struct ctdb_db_context *db; struct ctdb_node *node = ctdb->nodes[ctdb->pnn]; + struct ctdb_client *client = NULL; /* dont allow any local clients to attach while we are in recovery mode * except for the recovery daemon. @@ -812,13 +813,9 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, * recovery daemons. */ if (client_id != 0) { - struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client); - - if (client == NULL) { - DEBUG(DEBUG_ERR,("DB Attach to database %s refused. Can not match clientid:%d to a client structure.\n", db_name, client_id)); - return -1; - } - + client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client); + } + if (client != NULL) { /* If the node is inactive it is not part of the cluster and we should not allow clients to attach to any databases -- 2.34.1