Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 0/3] Force compaction if there too many DELETEs
Date: Sat, 20 Oct 2018 21:23:07 +0300	[thread overview]
Message-ID: <cover.1540057300.git.vdavydov.dev@gmail.com> (raw)

Normally, space amplification of a vinyl index is confined by the
configured LSM tree shape and shouldn't exceed 3-4. However, this
might not hold in case indexed fields are frequently updated, e.g.

  s = box.schema.space.create('test', {engine = 'vinyl'})
  s:create_index('primary')
  s:create_index('secondary', {parts = {2, 'unsigned'}})

  s:update(key, {{'+', 2, 1}}) -- there a lot of updates like this

Such a workload will generate tons of DELETE statement in the secondary
index, and they won't be purged until major compaction is scheduled,
which may not happen for a very very long time, resulting in space
amplification getting as high as 100 or even 1000.

This patch set fixes this issue by forcing major compaction of a range
in case the number of DELETEs plus statements that they are supposed to
purge exceeds a half of all statements in the range. This should prevent
space and read amplification from growing to insane heights.

Note, it doesn't close #3225, because that issue is also about forcing
compaction in case the observed read amplification gets too high, which
isn't addressed by this particular patch set.

https://github.com/tarantool/tarantool/issues/3225
https://github.com/tarantool/tarantool/commits/dv/gh-3225-vy-force-compaction-when-there-are-too-many-deletes

Vladimir Davydov (3):
  vinyl: remove useless local var from vy_range_update_compact_priority
  vinyl: account disk statements of each type
  vinyl: force major compaction if there are too many DELETEs

 src/box/iproto_constants.c          |   1 +
 src/box/iproto_constants.h          |   2 +
 src/box/vinyl.c                     |   6 ++
 src/box/vy_lsm.c                    |   2 +
 src/box/vy_range.c                  |  27 +++++++--
 src/box/vy_run.c                    |  82 +++++++++++++++++++++++++-
 src/box/vy_run.h                    |  10 ++++
 src/box/vy_stat.h                   |  65 +++++++++++++++++++++
 test/vinyl/compact.result           |  40 +++++++++++++
 test/vinyl/compact.test.lua         |  18 ++++++
 test/vinyl/deferred_delete.result   |  26 +++++++--
 test/vinyl/deferred_delete.test.lua |  15 ++++-
 test/vinyl/info.result              | 113 +++++++++++++++++++++++++++++++++---
 test/vinyl/info.test.lua            |  36 ++++++++++++
 test/vinyl/layout.result            |  12 ++--
 test/vinyl/update_optimize.result   |   9 ++-
 test/vinyl/update_optimize.test.lua |   5 +-
 17 files changed, 440 insertions(+), 29 deletions(-)

-- 
2.11.0

             reply	other threads:[~2018-10-20 18:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-20 18:23 Vladimir Davydov [this message]
2018-10-20 18:23 ` [PATCH 1/3] vinyl: remove useless local var from vy_range_update_compact_priority Vladimir Davydov
2018-10-23  8:51   ` [tarantool-patches] " Konstantin Osipov
2018-10-24 11:19     ` Vladimir Davydov
2018-10-20 18:23 ` [PATCH 2/3] vinyl: account disk statements of each type Vladimir Davydov
2018-10-23  8:58   ` [tarantool-patches] " Konstantin Osipov
2018-10-24 11:19     ` Vladimir Davydov
2018-10-20 18:23 ` [PATCH 3/3] vinyl: force major compaction if there are too many DELETEs Vladimir Davydov
2018-10-23  9:03   ` [tarantool-patches] " Konstantin Osipov

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=cover.1540057300.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 0/3] Force compaction if there too many DELETEs' \
    /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