aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-08 16:36:02 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-08 16:36:02 +0100
commit0f74ebee2bcb2714390bdc861bbec2017093289c (patch)
treec98491e2e8a9416871f3e3e795bc61e3f7d6d926 /src
parent7cebce161cf610c806fbf0b2d326baf4429256fb (diff)
downloadrspamd-0f74ebee2bcb2714390bdc861bbec2017093289c.tar.gz
rspamd-0f74ebee2bcb2714390bdc861bbec2017093289c.zip
Allow opening of fuzzy storage with no vacuum.
Diffstat (limited to 'src')
-rw-r--r--src/fuzzy_storage.c6
-rw-r--r--src/libserver/fuzzy_backend.c12
-rw-r--r--src/libserver/fuzzy_backend.h3
3 files changed, 16 insertions, 5 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 51611d523..7ed5ea6b1 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -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);
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c
index 41363ae13..dad109819 100644
--- a/src/libserver/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend.c
@@ -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) {
diff --git a/src/libserver/fuzzy_backend.h b/src/libserver/fuzzy_backend.h
index f0b934c3e..41a6096dd 100644
--- a/src/libserver/fuzzy_backend.h
+++ b/src/libserver/fuzzy_backend.h
@@ -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);
/**