freeze: Refactor code to check if databases are frozen
authorAmitay Isaacs <amitay@gmail.com>
Thu, 21 Aug 2014 02:26:58 +0000 (12:26 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 3 Mar 2015 01:28:54 +0000 (12:28 +1100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
include/ctdb_private.h
server/ctdb_freeze.c

index 230e8d8a69fff07dfb73e3151751abc56c0ef728..3f6b62846674533cd0f6f5d5c2bd9753b6ba1c42 100644 (file)
@@ -1076,6 +1076,7 @@ int32_t ctdb_control_thaw_db(struct ctdb_context *ctdb, uint32_t db_id);
 int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply);
 int32_t ctdb_control_thaw(struct ctdb_context *ctdb, uint32_t priority,
                          bool check_recmode);
+bool ctdb_is_frozen(struct ctdb_context *ctdb);
 
 int ctdb_start_recoverd(struct ctdb_context *ctdb);
 void ctdb_stop_recoverd(struct ctdb_context *ctdb);
index 554ef4c2ce612889b9136bfc3bd3d1af728012bf..8bbcd5cd1466ff5d4fe76e4551ac32f3c3ae80f8 100644 (file)
@@ -653,3 +653,15 @@ int32_t ctdb_control_wipe_database(struct ctdb_context *ctdb, TDB_DATA indata)
 
        return 0;
 }
+
+bool ctdb_is_frozen(struct ctdb_context *ctdb)
+{
+       int i;
+
+       for (i=1; i<=NUM_DB_PRIORITIES; i++) {
+               if (ctdb->freeze_mode[i] != CTDB_FREEZE_FROZEN) {
+                       return false;
+               }
+       }
+       return true;
+}