Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] vinyl: reset dump watermark after updating memory limit
@ 2019-03-15 14:11 Vladimir Davydov
  2019-03-15 14:12 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Davydov @ 2019-03-15 14:11 UTC (permalink / raw)
  To: tarantool-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] vinyl: reset dump watermark after updating memory limit
  2019-03-15 14:11 [PATCH] vinyl: reset dump watermark after updating memory limit Vladimir Davydov
@ 2019-03-15 14:12 ` Vladimir Davydov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2019-03-15 14:12 UTC (permalink / raw)
  To: tarantool-patches

On Fri, Mar 15, 2019 at 05:11:51PM +0300, Vladimir Davydov wrote:
> 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(-)

Trivial. Pushed to 2.1.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-15 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 14:11 [PATCH] vinyl: reset dump watermark after updating memory limit Vladimir Davydov
2019-03-15 14:12 ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox