}
+/*
+ * compact (defragment) the database , possibly returning space back to the underlying filesystem
+ */
+void cdb_compact(void)
+{
+ int ret;
+ int i;
+
+ syslog(LOG_DEBUG, "db: cdb_compact() started");
+ for (i = 0; i < MAXCDB; i++) {
+ syslog(LOG_DEBUG, "db: compacting database %d", i);
+ ret = dbp[i]->compact(dbp[i], NULL, NULL, NULL, NULL, DB_FREE_SPACE, NULL);
+ if (ret) {
+ syslog(LOG_ERR, "db: compact: %s", db_strerror(ret));
+ }
+ }
+ syslog(LOG_DEBUG, "db: cdb_compact() finished");
+}
+
// Has an item already been seen (is it in the CDB_USETABLE) ?
// Returns 0 if it hasn't, 1 if it has
/*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2017 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
void cdb_checkpoint(void);
void check_handles(void *arg);
void cdb_cull_logs(void);
+void cdb_compact(void);
/*
syslog(LOG_NOTICE, "Processed %d message reference count adjustments.", retval);
}
+ // Enable this after we've tested it and make it a site-configurable option.
+ // This will allow the database files to shrink when they can.
+ // if (!server_shutting_down)
+ // {
+ // cdb_compact();
+ // }
+
if (!server_shutting_down)
{
syslog(LOG_INFO, "Auto-purger: finished.");