From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH] vinyl: fix vy_range_update_compaction_priority hang
Date: Mon, 8 Jul 2019 16:36:27 +0300 [thread overview]
Message-ID: <75dc3e64523c54640805f6d6bd798d961a75fb9e.1562592949.git.vdavydov.dev@gmail.com> (raw)
Under certain circumstances vy_slice_new() may create an empty slice,
e.g. on range split:
|------------------ Slice ---------------|
|---- Run -----|
+
split key
|---- Slice 1 ----||------ Slice 2 ------|
^^^^^^^
Empty
vy_range_update_compaction_priority() uses the size of the last slice in
a range as a base for LSM tree level sizing. If the slice size happens
to be 0, it will simply hang in an infinite loop. Fix this potential
hang by using 1 if the last slice size is 0.
---
https://github.com/tarantool/tarantool/commits/dv/vy-fix-compaction-prio-calc-hang
src/box/vy_range.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/box/vy_range.c b/src/box/vy_range.c
index 395639dc..4ff85211 100644
--- a/src/box/vy_range.c
+++ b/src/box/vy_range.c
@@ -343,7 +343,7 @@ vy_range_update_compaction_priority(struct vy_range *range,
uint64_t size;
struct vy_slice *slice;
slice = rlist_last_entry(&range->slices, struct vy_slice, in_range);
- size = slice->count.bytes;
+ size = MAX(slice->count.bytes, 1);
slice = rlist_first_entry(&range->slices, struct vy_slice, in_range);
do {
target_run_size = size;
--
2.11.0
next reply other threads:[~2019-07-08 13:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 13:36 Vladimir Davydov [this message]
2019-07-08 13:48 ` Konstantin Osipov
2019-07-08 13:51 ` Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75dc3e64523c54640805f6d6bd798d961a75fb9e.1562592949.git.vdavydov.dev@gmail.com \
--to=vdavydov.dev@gmail.com \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH] vinyl: fix vy_range_update_compaction_priority hang' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox