vacuum: disabling vacuuming during a freeze
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 21 Jul 2010 02:58:04 +0000 (12:28 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 18 Aug 2010 01:31:52 +0000 (11:01 +0930)
We shouldn't even think about vacuuming when we've frozen the database
(which is earlier than when we set CTDB_RECOVERY_ACTIVE)

CQ:S1018154 & S1018349
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
server/ctdb_vacuum.c

index 59ce0ec284350e36ae362d9047a019350b5dba15..ec1da3d97b5c034e45b8266a51f6152cf7fa4427 100644 (file)
@@ -808,8 +808,14 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
        struct ctdb_vacuum_child_context *child_ctx;
        int ret;
 
-       /* we dont vacuum if we are in recovery mode */
-       if (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE) {
+       /* we dont vacuum if we are in recovery mode, or db frozen */
+       if (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE ||
+           ctdb->freeze_mode[ctdb_db->priority] != CTDB_FREEZE_NONE) {
+               DEBUG(DEBUG_INFO, ("Not vacuuming %s (%s)\n", ctdb_db->db_name,
+                                  ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE ? "in recovery"
+                                  : ctdb->freeze_mode[ctdb_db->priority] == CTDB_FREEZE_PENDING
+                                  ? "freeze pending"
+                                  : "frozen"));
                event_add_timed(ctdb->ev, vacuum_handle, timeval_current_ofs(ctdb->tunable.vacuum_default_interval, 0), ctdb_vacuum_event, vacuum_handle);
                return;
        }