Tarantool development patches archive
 help / color / mirror / Atom feed
From: Ilya Kosarev <i.kosarev@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: v.shpilevoy@tarantool.org
Subject: [Tarantool-patches] [PATCH v4 0/4] Safe truncation and deletion
Date: Fri, 14 Feb 2020 22:39:42 +0300	[thread overview]
Message-ID: <cover.1581705033.git.i.kosarev@tarantool.org> (raw)

space:truncate() and space:delete() could fail on memory allocations
when reaching memtx_memory limit. As far as it is quite an ill
behaviour, it is fixed in this patchset through memtx quota strictness
adjustment. Now it can be overused if needed.
Also possible bps_tree_create_leaf NULL dereference issue is fixed.

Branch: https://github.com/tarantool/tarantool/tree/i.kosarev/gh-3807-safe-alloc-on-truncation
Issue: https://github.com/tarantool/tarantool/issues/3807

Changes in v2:
  Approach changed completely: now we are not trying to allocate
  service tuples in some safe way, but increasing memtx quota so
  that space:truncate() and space:delete() won't fail on allocation.

Changes in v3:
  Now we are not increasing memtx quota. Instead we just set a flag to
  allow quota overuse for space:truncate() and space:delete().

Changes in v4:
  improved quota on/off flag style
  took into account fail cases for box_upsert in space_truncate
  now we are switching the quota off for deletion only in case there is
  OutOfMemory error in diag
  removed extra checks
  added tests

Ilya Kosarev (4):
  small: bump small version
  b-tree: return NULL on matras_alloc fail
  memtx: allow quota overuse for truncation and deletion
  test: add tests for truncation and deletion

 src/box/box.cc                       |  27 ++++++-
 src/box/memtx_space.c                |  33 ++++++--
 src/lib/core/errinj.h                |   1 +
 src/lib/salad/bps_tree.h             |  22 +++++-
 src/lib/small                        |   2 +-
 test/box/errinj.result               |   1 +
 test/engine/engine.cfg               |   6 ++
 test/engine/low_memory.lua           |   8 ++
 test/engine/stress_delete.result     | 111 +++++++++++++++++++++++++++
 test/engine/stress_delete.test.lua   |  55 +++++++++++++
 test/engine/stress_truncate.result   | 103 +++++++++++++++++++++++++
 test/engine/stress_truncate.test.lua |  52 +++++++++++++
 12 files changed, 408 insertions(+), 13 deletions(-)
 create mode 100644 test/engine/low_memory.lua
 create mode 100644 test/engine/stress_delete.result
 create mode 100644 test/engine/stress_delete.test.lua
 create mode 100644 test/engine/stress_truncate.result
 create mode 100644 test/engine/stress_truncate.test.lua

-- 
2.17.1

             reply	other threads:[~2020-02-14 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 19:39 Ilya Kosarev [this message]
2020-02-14 19:39 ` [Tarantool-patches] [PATCH v4 1/4] small: bump small version Ilya Kosarev
2020-02-14 19:39 ` [Tarantool-patches] [PATCH v4 2/4] b-tree: return NULL on matras_alloc fail Ilya Kosarev
2020-02-14 23:50   ` Vladislav Shpilevoy
2020-02-14 19:39 ` [Tarantool-patches] [PATCH v4 3/4] memtx: allow quota overuse for truncation and deletion Ilya Kosarev
2020-02-14 23:50   ` Vladislav Shpilevoy
2020-02-14 19:39 ` [Tarantool-patches] [PATCH v4 4/4] test: add tests " Ilya Kosarev
2020-02-14 23:50   ` Vladislav Shpilevoy
2020-02-14 21:00 ` [Tarantool-patches] [PATCH v4 0/4] Safe " Konstantin Osipov
2020-02-14 21:12   ` Ilya Kosarev

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.1581705033.git.i.kosarev@tarantool.org \
    --to=i.kosarev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 0/4] Safe truncation and deletion' \
    /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