Fix #415, fix sqlite-index error

This commit is contained in:
2023-09-16 09:43:55 -04:00
parent 8fdb832c85
commit a19ec3305a
10 changed files with 38 additions and 36 deletions

View File

@@ -1,8 +1,6 @@
#include "ctx.h"
ScanCtx_t ScanCtx = {
.stat_index_size = 0,
.stat_tn_size = 0,
.pool = NULL,
.index.path = {0,},
};

View File

@@ -31,9 +31,6 @@ typedef struct {
int depth;
int calculate_checksums;
size_t stat_tn_size;
size_t stat_index_size;
pcre *exclude;
pcre_extra *exclude_extra;
int fast;

View File

@@ -149,7 +149,7 @@ void database_open(database_t *db) {
}
#ifdef SIST_DEBUG
CRASH_IF_NOT_SQLITE_OK(sqlite3_exec(db->db, "PRAGMA foreign_keys = ON;", NULL, NULL, NULL));
// CRASH_IF_NOT_SQLITE_OK(sqlite3_exec(db->db, "PRAGMA foreign_keys = ON;", NULL, NULL, NULL));
#else
CRASH_IF_NOT_SQLITE_OK(sqlite3_exec(db->db, "PRAGMA ignore_check_constraints = ON;", NULL, NULL, NULL));
#endif
@@ -373,7 +373,7 @@ void database_open(database_t *db) {
}
void database_close(database_t *db, int optimize) {
LOG_DEBUGF("database.c", "Closing database %s", db->filename);
LOG_DEBUGF("database.c", "Closing database %s (%p)", db->filename, db->db);
if (optimize) {
LOG_DEBUG("database.c", "Optimizing database");
@@ -594,8 +594,9 @@ cJSON *database_document_iter(database_iterator_t *iter) {
cJSON *database_incremental_scan_begin(database_t *db) {
LOG_DEBUG("database.c", "Preparing database for incremental scan");
CRASH_IF_NOT_SQLITE_OK(sqlite3_exec(db->db, "DELETE FROM marked;", NULL, NULL, NULL));
LOG_DEBUG("database.c", "Preparing database for incremental scan (create marked table)");
CRASH_IF_NOT_SQLITE_OK(
sqlite3_exec(db->db, "INSERT INTO marked SELECT ROWID, 0, mtime FROM document;", NULL, NULL, NULL));
sqlite3_exec(db->db, "INSERT INTO marked SELECT id, 0, mtime FROM document;", NULL, NULL, NULL));
}
cJSON *database_incremental_scan_end(database_t *db) {

View File

@@ -260,9 +260,6 @@ void sist2_scan(scan_args_t *args) {
tpool_wait(ScanCtx.pool);
tpool_destroy(ScanCtx.pool);
LOG_DEBUGF("main.c", "Thumbnail store size: %lu", ScanCtx.stat_tn_size);
LOG_DEBUGF("main.c", "Index size: %lu", ScanCtx.stat_index_size);
database_t *db = database_create(args->output, INDEX_DATABASE);
database_open(db);
@@ -356,7 +353,6 @@ void sist2_sqlite_index(sqlite_index_args_t *args) {
database_fts_optimize(db);
database_close(db, FALSE);
database_close(search_db, FALSE);
}
void sist2_web(web_args_t *args) {

View File

@@ -55,7 +55,7 @@
static const char *const Version = VERSION;
static const int VersionMajor = 3;
static const int VersionMinor = 3;
static const int VersionPatch = 0;
static const int VersionPatch = 1;
#ifndef SIST_PLATFORM
#define SIST_PLATFORM unknown

View File

@@ -110,11 +110,11 @@ static void worker_thread_loop(tpool_t *pool) {
if (LogCtx.json_logs) {
progress_bar_print_json(done,
count,
ScanCtx.stat_tn_size,
ScanCtx.stat_index_size, pool->shm->waiting);
0,
0, pool->shm->waiting);
} else {
progress_bar_print((double) done / count,
ScanCtx.stat_tn_size, ScanCtx.stat_index_size);
0, 0);
}
}
@@ -272,7 +272,7 @@ void tpool_wait(tpool_t *pool) {
}
}
if (pool->print_progress && !LogCtx.json_logs) {
progress_bar_print(1.0, ScanCtx.stat_tn_size, ScanCtx.stat_index_size);
progress_bar_print(1.0, 0, 0);
}
pthread_mutex_unlock(&pool->shm->mutex);