iIt is better to plainly disallow clietnts from connecting here
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 24 Nov 2009 21:03:42 +0000 (08:03 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 24 Nov 2009 21:03:42 +0000 (08:03 +1100)
if the node is BANNED.
Dont even let them attach at all
to the database

Revert "temporarily try allowing clients to attach to databases even if
the node is banned/stopped or inactive in any other way."

This reverts commit 227fe99f105bdc3a4f1000f238cbe3adeb3f22f0.

server/ctdb_ltdb_server.c

index 1aa0f697476042e4d4574fbe74d0fc32c4ae7a22..9a58c23b7224b1fbf6feca20b6213eb6fc478dfa 100644 (file)
@@ -318,9 +318,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;
-#if 0
        struct ctdb_node *node = ctdb->nodes[ctdb->pnn];
-#endif
 
        /* the client can optionally pass additional tdb flags, but we
           only allow a subset of those on the database in ctdb. Note
@@ -328,25 +326,24 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
           srvid to the attach control */
        tdb_flags &= TDB_NOSYNC;
 
-       /* see if we already have this name */
-       db = ctdb_db_handle(ctdb, db_name);
-       if (db != NULL) {
-               outdata->dptr  = (uint8_t *)&db->db_id;
-               outdata->dsize = sizeof(db->db_id);
-               tdb_add_flags(db->ltdb->tdb, tdb_flags);
-               return 0;
-       }
-
-#if 0
        /* If the node is inactive it is not part of the cluster
-          and we should not allow clients to attach to any new
+          and we should not allow clients to attach to any
           databases
        */
        if (node->flags & NODE_FLAGS_INACTIVE) {
                DEBUG(DEBUG_ERR,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
                return -1;
        }
-#endif
+
+
+       /* see if we already have this name */
+       db = ctdb_db_handle(ctdb, db_name);
+       if (db) {
+               outdata->dptr  = (uint8_t *)&db->db_id;
+               outdata->dsize = sizeof(db->db_id);
+               tdb_add_flags(db->ltdb->tdb, tdb_flags);
+               return 0;
+       }
 
        if (ctdb_local_attach(ctdb, db_name, persistent) != 0) {
                return -1;