From 4318075157b5f3b4eecbe03aeed4aac269c9ab4d Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Sun, 9 Jul 2017 12:00:38 +0300 Subject: [PATCH] vinyl: add comments on why we may use memory quota at commit --- src/box/vinyl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index 54402a8bba..892983003b 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -5943,12 +5943,19 @@ void vy_commit(struct vy_tx *tx, int64_t lsn) { struct vy_env *env = tx->xm->env; + /* + * vy_tx_commit() may trigger an upsert squash. + * If there is no memory for a created statement, + * it silently fails. But if it succeeds, we + * need to account the memory in the quota. + */ size_t mem_used_before = lsregion_used(&env->allocator); vy_tx_commit(tx, lsn); size_t mem_used_after = lsregion_used(&env->allocator); assert(mem_used_after >= mem_used_before); + /* We can't abort the transaction at this point, use force. */ vy_quota_force_use(&env->quota, mem_used_after - mem_used_before); mempool_free(&tx->xm->tx_mempool, tx); -- GitLab