]> source.dussan.org Git - rspamd.git/commitdiff
Allow opening of fuzzy storage with no vacuum.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 8 Oct 2015 15:36:02 +0000 (16:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 8 Oct 2015 15:36:02 +0000 (16:36 +0100)
src/fuzzy_storage.c
src/libserver/fuzzy_backend.c
src/libserver/fuzzy_backend.h

index 51611d5230587aa53b945fd02b51e69139710633..7ed5ea6b117bd308fc9078d693aa5f6b4e239b12 100644 (file)
@@ -507,6 +507,7 @@ start_fuzzy (struct rspamd_worker *worker)
        struct rspamd_fuzzy_storage_ctx *ctx = worker->ctx;
        GError *err = NULL;
        gdouble next_check;
+       struct event usr2_
 
        ctx->ev_base = rspamd_prepare_worker (worker,
                        "fuzzy",
@@ -514,7 +515,10 @@ start_fuzzy (struct rspamd_worker *worker)
        server_stat = worker->srv->stat;
 
 
-       if ((ctx->backend = rspamd_fuzzy_backend_open (ctx->hashfile, &err)) == NULL) {
+       /*
+        * Open DB and perform VACUUM
+        */
+       if ((ctx->backend = rspamd_fuzzy_backend_open (ctx->hashfile, TRUE, &err)) == NULL) {
                msg_err ("cannot open backend: %e", err);
                g_error_free (err);
                exit (EXIT_SUCCESS);
index 41363ae13a1c4a29169ea8bc5223dbc10ea2f66a..dad109819fc4c2ef2228ee880eb55f3188914278 100644 (file)
@@ -407,8 +407,10 @@ rspamd_fuzzy_backend_open_db (const gchar *path, GError **err)
        return bk;
 }
 
-struct rspamd_fuzzy_backend*
-rspamd_fuzzy_backend_open (const gchar *path, GError **err)
+struct rspamd_fuzzy_backend *
+rspamd_fuzzy_backend_open (const gchar *path,
+               gboolean vacuum,
+               GError **err)
 {
        gchar *dir;
        gint fd;
@@ -494,7 +496,11 @@ rspamd_fuzzy_backend_open (const gchar *path, GError **err)
                                sqlite3_errmsg (backend->db));
        }
 
-       rspamd_fuzzy_backend_run_simple (RSPAMD_FUZZY_BACKEND_VACUUM, backend, NULL);
+       if (vacuum) {
+               rspamd_fuzzy_backend_run_simple (RSPAMD_FUZZY_BACKEND_VACUUM,
+                               backend,
+                               NULL);
+       }
 
        if (rspamd_fuzzy_backend_run_stmt (backend, RSPAMD_FUZZY_BACKEND_COUNT)
                        == SQLITE_OK) {
index f0b934c3efd1f92c72b779e4548bedc2dd95011f..41a6096dd2caf7640126e085fcc8eaf6f2dfa9be 100644 (file)
@@ -35,7 +35,8 @@ struct rspamd_fuzzy_backend;
  * @param err error pointer
  * @return backend structure or NULL
  */
-struct rspamd_fuzzy_backend* rspamd_fuzzy_backend_open (const gchar *path,
+struct rspamd_fuzzy_backend *rspamd_fuzzy_backend_open (const gchar *path,
+               gboolean vacuum,
                GError **err);
 
 /**