From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH] vinyl: reset dump watermark after updating memory limit
Date: Fri, 15 Mar 2019 17:11:51 +0300 [thread overview]
Message-ID: <b15773fae61d31d5aa8a586ed4d816632fd1bd4a.1552659087.git.vdavydov.dev@gmail.com> (raw)
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
---
https://github.com/tarantool/tarantool/issues/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 970fff5b..c2b7eb78 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 d3fc1a4a..eebfe805 100644
--- a/src/box/vy_regulator.c
+++ b/src/box/vy_regulator.c
@@ -268,6 +268,13 @@ vy_regulator_dump_complete(struct vy_regulator *regulator,
}
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)
{
histogram_reset(regulator->dump_bandwidth_hist);
diff --git a/src/box/vy_regulator.h b/src/box/vy_regulator.h
index 341f41df..65c1672d 100644
--- a/src/box/vy_regulator.h
+++ b/src/box/vy_regulator.h
@@ -152,6 +152,12 @@ 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.
*/
--
2.11.0
next reply other threads:[~2019-03-15 14:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 14:11 Vladimir Davydov [this message]
2019-03-15 14:12 ` 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=b15773fae61d31d5aa8a586ed4d816632fd1bd4a.1552659087.git.vdavydov.dev@gmail.com \
--to=vdavydov.dev@gmail.com \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH] vinyl: reset dump watermark after updating memory limit' \
/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