From b15773fae61d31d5aa8a586ed4d816632fd1bd4a Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov.dev@gmail.com> Date: Fri, 15 Mar 2019 17:01:34 +0300 Subject: [PATCH] vinyl: reset dump watermark after updating memory limit The watermark is updated every second anyway, however not updating it when the limit is reset results in vinyl/quota test failure: | --- vinyl/quota.result Thu Mar 14 16:03:54 2019 | +++ vinyl/quota.reject Fri Mar 15 16:32:44 2019 | @@ -146,7 +146,7 @@ | for i = 1, count do s:replace{i, pad} end -- does not trigger dump | --- | ... | -box.stat.vinyl().memory.level0 > count * pad:len() | +box.stat.vinyl().memory.level0 > count * pad:len() or box.stat.vinyl() | --- | - true | ... Closes #3864 --- src/box/vinyl.c | 2 +- src/box/vy_regulator.c | 7 +++++++ src/box/vy_regulator.h | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index 970fff5bfe..c2b7eb78f2 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -2663,7 +2663,7 @@ vinyl_engine_set_memory(struct vinyl_engine *vinyl, size_t size) "cannot decrease memory size at runtime"); return -1; } - vy_quota_set_limit(&vinyl->env->quota, size); + vy_regulator_set_memory_limit(&vinyl->env->regulator, size); return 0; } diff --git a/src/box/vy_regulator.c b/src/box/vy_regulator.c index d3fc1a4a90..eebfe8057c 100644 --- a/src/box/vy_regulator.c +++ b/src/box/vy_regulator.c @@ -267,6 +267,13 @@ vy_regulator_dump_complete(struct vy_regulator *regulator, regulator->dump_bandwidth); } +void +vy_regulator_set_memory_limit(struct vy_regulator *regulator, size_t limit) +{ + vy_quota_set_limit(regulator->quota, limit); + vy_regulator_update_dump_watermark(regulator); +} + void vy_regulator_reset_dump_bandwidth(struct vy_regulator *regulator, size_t max) { diff --git a/src/box/vy_regulator.h b/src/box/vy_regulator.h index 341f41df45..65c1672d27 100644 --- a/src/box/vy_regulator.h +++ b/src/box/vy_regulator.h @@ -151,6 +151,12 @@ void vy_regulator_dump_complete(struct vy_regulator *regulator, size_t mem_dumped, double dump_duration); +/** + * Set memory limit and update the dump watermark accordingly. + */ +void +vy_regulator_set_memory_limit(struct vy_regulator *regulator, size_t limit); + /** * Reset dump bandwidth histogram and update initial estimate. * Called when box.cfg.snap_io_rate_limit is updated. -- GitLab