ctdb-daemon: Avoid the use of ctdb->freeze_handle variable
authorAmitay Isaacs <amitay@gmail.com>
Tue, 15 Sep 2015 02:22:17 +0000 (12:22 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 7 Oct 2015 12:53:26 +0000 (14:53 +0200)
These variables are used for state information related to freezing
databases.  Instead use the API functions to check if the databases
are frozen.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_monitor.c
ctdb/server/ctdb_recover.c

index 6dd7c1e637a321b1c6b80810d4d9130e1cee20cb..edaae48ff8ed0a0b186aa39ef3623b0aed7465a0 100644 (file)
@@ -368,14 +368,10 @@ static void ctdb_check_health(struct event_context *ev, struct timed_event *te,
            ctdb->monitor->monitoring_mode == CTDB_MONITORING_DISABLED) {
                skip_monitoring = true;
        } else {
-               int i;
-               for (i=1; i<=NUM_DB_PRIORITIES; i++) {
-                       if (ctdb->freeze_handles[i] != NULL) {
-                               DEBUG(DEBUG_ERR,
-                                     ("Skip monitoring since databases are frozen\n"));
-                               skip_monitoring = true;
-                               break;
-                       }
+               if (ctdb_db_all_frozen(ctdb)) {
+                       DEBUG(DEBUG_ERR,
+                             ("Skip monitoring since databases are frozen\n"));
+                       skip_monitoring = true;
                }
        }
 
index 3a638fac361a6e435ffa3705466885b7a3cc42f9..0df7f58902dbe841cf6ff7df77b027d9406ba301 100644 (file)
@@ -558,7 +558,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
 
        /* force the databases to thaw */
        for (i=1; i<=NUM_DB_PRIORITIES; i++) {
-               if (ctdb->freeze_handles[i] != NULL) {
+               if (ctdb_db_prio_frozen(ctdb, i)) {
                        ctdb_control_thaw(ctdb, i, false);
                }
        }