X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fdatabase.c;h=2e80b599df74cb0a2a95393b05468326eeff8f95;hp=9a22c8d2c62a6ca7af9c819fdb879946db3b2db4;hb=6f9208392ee576a322edbc389c32d27ceaa3c04f;hpb=a55b22e1215903d726353fb6b9f7c3608eb61c0d diff --git a/citadel/database.c b/citadel/database.c index 9a22c8d2c..2e80b599d 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -163,48 +163,6 @@ void cdb_check_handles(void) } -/* - * Cull the database logs by removing log files that are no longer needed. - * Note: this code will be removed once we are confident that Berkeley DB can do this on its own. - */ -void cdb_cull_logs(void) -{ -#ifndef DB_LOG_AUTO_REMOVE - u_int32_t flags; - int ret; - char **file, **list; - char errmsg[SIZ]; - - flags = DB_ARCH_ABS; - - /* Get the list of names. */ - if ((ret = dbenv->log_archive(dbenv, &list, flags)) != 0) { - syslog(LOG_ERR, "db: cdb_cull_logs() %s", db_strerror(ret)); - return; - } - - /* Print the list of names. */ - if (list != NULL) { - for (file = list; *file != NULL; ++file) { - syslog(LOG_DEBUG, "db: deleting log %s", *file); - ret = unlink(*file); - if (ret != 0) { - snprintf(errmsg, sizeof(errmsg), - " ** ERROR **\n \n \n " - "Citadel was unable to delete the " - "database log file '%s' because of the " - "following error:\n \n %s\n \n" - " This log file is no longer in use " - "and may be safely deleted.\n", *file, strerror(errno)); - CtdlAideMessage(errmsg, "Database Warning Message"); - } - } - free(list); - } -#endif /* DB_LOG_AUTO_REMOVE */ -} - - /* * Request a checkpoint of the database. Called once per minute by the thread manager. */ @@ -222,18 +180,11 @@ void cdb_checkpoint(void) /* After a successful checkpoint, we can cull the unused logs */ if (CtdlGetConfigInt("c_auto_cull")) { -#ifdef DB_LOG_AUTO_REMOVE - // This version of Berkeley DB can cull the logs on its own! ret = dbenv->log_set_config(dbenv, DB_LOG_AUTO_REMOVE, 1); -#else - cdb_cull_logs(); // Citadel knows how to do it too. -#endif } -#ifdef DB_LOG_AUTO_REMOVE else { ret = dbenv->log_set_config(dbenv, DB_LOG_AUTO_REMOVE, 0); } -#endif }