mirror of
https://github.com/simon987/sist2.git
synced 2025-04-18 17:56:44 +00:00
Print progress bar in index module
This commit is contained in:
parent
414f65346c
commit
b17b9439df
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
ScanCtx_t ScanCtx = {
|
ScanCtx_t ScanCtx = {
|
||||||
.stat_index_size = 0,
|
.stat_index_size = 0,
|
||||||
|
.stat_tn_size = 0,
|
||||||
.dbg_current_files = NULL,
|
.dbg_current_files = NULL,
|
||||||
.pool = NULL
|
.pool = NULL
|
||||||
};
|
};
|
||||||
|
@ -253,7 +253,7 @@ void _elastic_flush(int max) {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
print_errors(r);
|
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);
|
delete_queue(max);
|
||||||
|
|
||||||
if (Indexer->queued != 0) {
|
if (Indexer->queued != 0) {
|
||||||
|
@ -23,7 +23,6 @@ store_t *store_create(const char *path, size_t chunk_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
store->size = (size_t) store->chunk_size;
|
store->size = (size_t) store->chunk_size;
|
||||||
ScanCtx.stat_tn_size = 0;
|
|
||||||
mdb_env_set_mapsize(store->env, store->size);
|
mdb_env_set_mapsize(store->env, store->size);
|
||||||
|
|
||||||
// Open dbi
|
// Open dbi
|
||||||
|
@ -433,7 +433,7 @@ void sist2_index(index_args_t *args) {
|
|||||||
cleanup = elastic_cleanup;
|
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);
|
tpool_start(IndexCtx.pool);
|
||||||
|
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
@ -177,7 +177,7 @@ static void *tpool_worker(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tpool_wait(tpool_t *pool) {
|
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));
|
pthread_mutex_lock(&(pool->work_mutex));
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (pool->done_cnt < pool->work_cnt) {
|
if (pool->done_cnt < pool->work_cnt) {
|
||||||
|
@ -88,7 +88,7 @@ void progress_bar_print(double percentage, size_t tn_size, size_t index_size) {
|
|||||||
|
|
||||||
static int last_val = -1;
|
static int last_val = -1;
|
||||||
int val = (int) (percentage * 100);
|
int val = (int) (percentage * 100);
|
||||||
if (last_val == val || val > 100 || index_size < 1024) {
|
if (last_val == val || val > 100) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
last_val = val;
|
last_val = val;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user