From bd5f2641a88ad209c663ddbcb60e3ebf88e2bcbb Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 11 Nov 2020 18:16:53 +0800 Subject: [PATCH] implement TD-2059 --- src/inc/tsdb.h | 1 + src/tsdb/src/tsdbMemTable.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 993ec287a5..d7515a1495 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 802ae3727b..5680abcc6f 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. * -- GitLab