diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 993ec287a530223df263327e8490e70567c9e500..d7515a14956d7029d909241b2985023d33e58622 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -323,6 +323,7 @@ void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int int tsdbInitCommitQueue(int nthreads); void tsdbDestroyCommitQueue(); +int tsdbSyncCommit(TSDB_REPO_T *repo); #ifdef __cplusplus } diff --git a/src/tsdb/src/tsdbMemTable.c b/src/tsdb/src/tsdbMemTable.c index 802ae3727b70cfad65ce20997f46ef7b7bacf3aa..5680abcc6f4bf7874b59583cbfe3815c8a72a0a2 100644 --- a/src/tsdb/src/tsdbMemTable.c +++ b/src/tsdb/src/tsdbMemTable.c @@ -278,6 +278,14 @@ int tsdbAsyncCommit(STsdbRepo *pRepo) { return 0; } +int tsdbSyncCommit(TSDB_REPO_T *repo) { + STsdbRepo *pRepo = (STsdbRepo *)repo; + tsdbAsyncCommit(pRepo); + sem_wait(&(pRepo->readyToCommit)); + sem_post(&(pRepo->readyToCommit)); + return 0; +} + /** * This is an important function to load data or try to load data from memory skiplist iterator. *