[PATCH] vinyl: reset dump watermark after updating memory limit
Vladimir Davydov
vdavydov.dev at gmail.com
Fri Mar 15 17:11:51 MSK 2019
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
More information about the Tarantool-patches
mailing list