From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@dev.tarantool.org, tsafin@tarantool.org, alyapunov@tarantool.org Subject: [Tarantool-patches] [PATCH 04/11] vinyl: fix 0 division in case of canceled dump Date: Fri, 5 Jun 2020 01:43:11 +0200 [thread overview] Message-ID: <4023e23c9affc53ad06ad439b5944236acf5a257.1591313754.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1591313754.git.v.shpilevoy@tarantool.org> It can happen, that vinyl index dump is scheduled, but the index is dropped before the dump starts. In this case the dump task is finished with 0 dump time. The time then is used in a log message to obtain dump rate as byte count / dump time. Since dump time is 0, this is undefined behaviour. Moreover, it was not even a dump, so nothing to log here. Also dump time is used to update throttling parameters in vy_regulator. Here if the dump took 0 time, there was no a dump, so it is just ignored. Part of #4609 --- src/box/vy_regulator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/box/vy_regulator.c b/src/box/vy_regulator.c index a6604c9f3..8ec7e25d6 100644 --- a/src/box/vy_regulator.c +++ b/src/box/vy_regulator.c @@ -291,9 +291,11 @@ vy_regulator_dump_complete(struct vy_regulator *regulator, vy_quota_set_rate_limit(regulator->quota, VY_QUOTA_RESOURCE_MEMORY, regulator->dump_bandwidth); - say_info("dumped %zu bytes in %.1f s, rate %.1f MB/s", - mem_dumped, dump_duration, - mem_dumped / dump_duration / 1024 / 1024); + if (dump_duration > 0) { + say_info("dumped %zu bytes in %.1f s, rate %.1f MB/s", + mem_dumped, dump_duration, + mem_dumped / dump_duration / 1024 / 1024); + } } void @@ -420,7 +422,7 @@ vy_regulator_update_rate_limit(struct vy_regulator *regulator, double compaction_time = stat->compaction_time - last->compaction_time; *last = *stat; - if (dump_input < (ssize_t)VY_DUMP_SIZE_ACCT_MIN) + if (dump_input < (ssize_t)VY_DUMP_SIZE_ACCT_MIN || compaction_time == 0) return; recent->dump_count += dump_count; -- 2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-06-04 23:43 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-04 23:43 [Tarantool-patches] [PATCH 00/11] Enable miscelaneous sanitations Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 01/11] cmake: enable misc types of UB detection in clang Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 10/11] sql: fix usage of not initialized index_stat Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 11/11] sql: fix mem_apply_type double type truncation Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 02/11] util: introduce double_compare_nint64() Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 03/11] test: avoid usleep() usage for error injections Vladislav Shpilevoy 2020-06-04 23:43 ` Vladislav Shpilevoy [this message] 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 05/11] xrow: don't cast double to float unconditionally Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 06/11] swim: fix zero division Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 07/11] test: fix signed integer overflow in vclock test Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 08/11] digest: eliminate UBs from guava() Vladislav Shpilevoy 2020-06-04 23:43 ` [Tarantool-patches] [PATCH 09/11] salad: fix UB pointer arithmetics in bps_tree Vladislav Shpilevoy 2020-06-05 22:09 ` [Tarantool-patches] [PATCH 00/11] Enable miscelaneous sanitations Timur Safin 2020-06-09 8:19 ` Cyrill Gorcunov 2020-06-09 8:28 ` Kirill Yukhin
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=4023e23c9affc53ad06ad439b5944236acf5a257.1591313754.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=alyapunov@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=tsafin@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 04/11] vinyl: fix 0 division in case of canceled dump' \ /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