* [PATCH] vinyl: fix vy_range_update_compaction_priority hang
@ 2019-07-08 13:36 Vladimir Davydov
2019-07-08 13:48 ` Konstantin Osipov
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Davydov @ 2019-07-08 13:36 UTC (permalink / raw)
To: kostja; +Cc: tarantool-patches
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vinyl: fix vy_range_update_compaction_priority hang
2019-07-08 13:36 [PATCH] vinyl: fix vy_range_update_compaction_priority hang Vladimir Davydov
@ 2019-07-08 13:48 ` Konstantin Osipov
2019-07-08 13:51 ` Vladimir Davydov
0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Osipov @ 2019-07-08 13:48 UTC (permalink / raw)
To: Vladimir Davydov; +Cc: tarantool-patches
* Vladimir Davydov <vdavydov.dev@gmail.com> [19/07/08 16:38]:
Please push this asap since there is a customer waiting for fix.
Please also fix VY_ROUND_UP type safety - let's make it static
inline instead.
This needs a test case as a follow up and a proper fix should drop
all such slices.
> 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
>
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vinyl: fix vy_range_update_compaction_priority hang
2019-07-08 13:48 ` Konstantin Osipov
@ 2019-07-08 13:51 ` Vladimir Davydov
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Davydov @ 2019-07-08 13:51 UTC (permalink / raw)
To: Konstantin Osipov; +Cc: tarantool-patches
On Mon, Jul 08, 2019 at 04:48:54PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/07/08 16:38]:
>
> Please push this asap since there is a customer waiting for fix.
Pushed to master, 2.1, and 1.10.
>
> Please also fix VY_ROUND_UP type safety - let's make it static
> inline instead.
I can't - we do need to pass double as a divident to it, because
run_size_ratio is double.
>
> This needs a test case as a follow up and a proper fix should drop
> all such slices.
That's going to be tricky. I'll look if we can actually do that.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-08 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 13:36 [PATCH] vinyl: fix vy_range_update_compaction_priority hang Vladimir Davydov
2019-07-08 13:48 ` Konstantin Osipov
2019-07-08 13:51 ` Vladimir Davydov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox