From Wolfgang Mueller
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 20 Oct 2009 02:01:15 +0000 (13:01 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 11 Jan 2010 22:46:39 +0000 (09:46 +1100)
make sure to always create the vactun database and get rid of some annoying log messages
(cherry picked from commit 54f9c314a0354f1039208fe6ac7dc159b6db8750)

Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com>
server/ctdb_vacuum.c

index 074acbbacd20d67d434bed0ebf46e87a3495274d..3676402fdc1a195decc2757d8ccf4cc51fc8d7ce 100644 (file)
@@ -524,7 +524,7 @@ static int update_tuning_db(struct ctdb_db_context *ctdb_db, struct vacuum_data
                return -1;
        }
 
-       tune_tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0600);
+       tune_tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0644);
        if (tune_tdb == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Failed to create/open %s\n", TUNINGDBNAME));
                talloc_free(tmp_ctx);
@@ -685,9 +685,9 @@ static int get_vacuum_interval(struct ctdb_db_context *ctdb_db)
                return interval;
        }
 
-       tdb = tdb_open(vac_dbname, 0, 0, O_RDONLY, 0600);
+       tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0644);
        if (!tdb) {
-               DEBUG(DEBUG_ERR,("Unable to open database %s using default interval\n", vac_dbname));
+               DEBUG(DEBUG_ERR,("Unable to open/create database %s using default interval\n", vac_dbname));
                talloc_free(tmp_ctx);
                return interval;
        }
@@ -711,8 +711,6 @@ static int get_vacuum_interval(struct ctdb_db_context *ctdb_db)
                        }
                }
                free(value.dptr);
-
-               DEBUG(DEBUG_NOTICE,("Using new interval %u for database %s\n", interval, ctdb_db->db_name));
        }
        tdb_close(tdb);
 
@@ -766,7 +764,7 @@ static void vacuum_child_handler(struct event_context *ev, struct fd_event *fde,
        char c = 0;
        int ret;
 
-       DEBUG(DEBUG_NOTICE,("Vacuuming child finished for db %s\n", child_ctx->vacuum_handle->ctdb_db->db_name));
+       DEBUG(DEBUG_NOTICE,("Vacuuming child process %d finished for db %s\n", child_ctx->child_pid, child_ctx->vacuum_handle->ctdb_db->db_name));
        child_ctx->child_pid = -1;
 
        ret = read(child_ctx->fd[0], &c, 1);
@@ -799,8 +797,6 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
                return;
        }
 
-       DEBUG(DEBUG_NOTICE,("Start a vacuuming child process for db %s\n", ctdb_db->db_name));
-
        child_ctx = talloc(vacuum_handle, struct ctdb_vacuum_child_context);
        if (child_ctx == NULL) {
                DEBUG(DEBUG_CRIT, (__location__ " Failed to allocate child context for vacuuming of %s\n", ctdb_db->db_name));
@@ -831,6 +827,8 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
                char cc = 0;
                close(child_ctx->fd[0]);
 
+               DEBUG(DEBUG_NOTICE,("Vacuuming child process %d for db %s started\n", getpid(), ctdb_db->db_name));
+       
                if (switch_from_server_to_client(ctdb) != 0) {
                        DEBUG(DEBUG_CRIT, (__location__ "ERROR: failed to switch vacuum daemon into client mode. Shutting down.\n"));
                        _exit(1);