From eecd2b90b69038e2c3fa23a4a1cdeb708e94b127 Mon Sep 17 00:00:00 2001 From: Nikita Pettik <korablev@tarantool.org> Date: Wed, 26 May 2021 16:17:45 +0300 Subject: [PATCH] vinyl: introduce vy_lsm_is_being_constructed() It tells whether LSM tree is currently being constructed, or is already built and committed. Needed for #6045 --- src/box/vy_lsm.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/box/vy_lsm.h b/src/box/vy_lsm.h index 3b553ea570..3178f83231 100644 --- a/src/box/vy_lsm.h +++ b/src/box/vy_lsm.h @@ -361,6 +361,16 @@ vy_lsm_is_empty(struct vy_lsm *lsm) lsm->stat.memory.count.rows == 0); } +/** + * Return true if LSM tree is currently being built + * (i.e. index_commit_create() hasn't been called yet). + */ +static inline bool +vy_lsm_is_being_constructed(struct vy_lsm *lsm) +{ + return lsm->commit_lsn < 0; +} + /** * Return the averange number of dumps it takes to trigger major * compaction of a range in this LSM tree. -- GitLab