From b17b9439df34c592146f05c0361c9b207f373f02 Mon Sep 17 00:00:00 2001 From: simon987 Date: Sun, 7 Nov 2021 13:20:05 -0500 Subject: [PATCH] Print progress bar in index module --- src/ctx.c | 1 + src/index/elastic.c | 2 +- src/io/store.c | 1 - src/main.c | 2 +- src/tpool.c | 2 +- src/util.c | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ctx.c b/src/ctx.c index d6ee8ec..3c24a9f 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -2,6 +2,7 @@ ScanCtx_t ScanCtx = { .stat_index_size = 0, + .stat_tn_size = 0, .dbg_current_files = NULL, .pool = NULL }; diff --git a/src/index/elastic.c b/src/index/elastic.c index abb682b..612158d 100644 --- a/src/index/elastic.c +++ b/src/index/elastic.c @@ -253,7 +253,7 @@ void _elastic_flush(int max) { } else { print_errors(r); - LOG_INFOF("elastic.c", "Indexed %d documents (%zukB) <%d>", count, buf_len / 1024, r->status_code); + LOG_DEBUGF("elastic.c", "Indexed %d documents (%zukB) <%d>", count, buf_len / 1024, r->status_code); delete_queue(max); if (Indexer->queued != 0) { diff --git a/src/io/store.c b/src/io/store.c index c5054bc..83ed24e 100644 --- a/src/io/store.c +++ b/src/io/store.c @@ -23,7 +23,6 @@ store_t *store_create(const char *path, size_t chunk_size) { } store->size = (size_t) store->chunk_size; - ScanCtx.stat_tn_size = 0; mdb_env_set_mapsize(store->env, store->size); // Open dbi diff --git a/src/main.c b/src/main.c index c6ca0dd..dcbdf96 100644 --- a/src/main.c +++ b/src/main.c @@ -433,7 +433,7 @@ void sist2_index(index_args_t *args) { cleanup = elastic_cleanup; } - IndexCtx.pool = tpool_create(args->threads, cleanup, FALSE, FALSE); + IndexCtx.pool = tpool_create(args->threads, cleanup, FALSE, TRUE); tpool_start(IndexCtx.pool); struct dirent *de; diff --git a/src/tpool.c b/src/tpool.c index e1630f1..945cfb0 100644 --- a/src/tpool.c +++ b/src/tpool.c @@ -177,7 +177,7 @@ static void *tpool_worker(void *arg) { } void tpool_wait(tpool_t *pool) { - LOG_INFO("tpool.c", "Waiting for worker threads to finish") + LOG_DEBUG("tpool.c", "Waiting for worker threads to finish") pthread_mutex_lock(&(pool->work_mutex)); while (TRUE) { if (pool->done_cnt < pool->work_cnt) { diff --git a/src/util.c b/src/util.c index 1972b93..d560df3 100644 --- a/src/util.c +++ b/src/util.c @@ -88,7 +88,7 @@ void progress_bar_print(double percentage, size_t tn_size, size_t index_size) { static int last_val = -1; int val = (int) (percentage * 100); - if (last_val == val || val > 100 || index_size < 1024) { + if (last_val == val || val > 100) { return; } last_val = val;