From b98587e674f015e0730f60e97a38cccc05329730 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Sun, 2 Aug 2015 10:16:13 +0300
Subject: [PATCH] memtx: allow delete if out of memory (wallarm complaint)

---
 src/box/memtx_engine.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/box/memtx_engine.cc b/src/box/memtx_engine.cc
index 69c77eb261..a825a23654 100644
--- a/src/box/memtx_engine.cc
+++ b/src/box/memtx_engine.cc
@@ -72,6 +72,7 @@ enum {
 	 * can lead to, and, as a result, the max
 	 * number of new block allocations.
 	 */
+	RESERVE_EXTENTS_BEFORE_DELETE = 8,
 	RESERVE_EXTENTS_BEFORE_REPLACE = 16
 };
 
@@ -178,7 +179,9 @@ memtx_replace_all_keys(struct txn *txn, struct space *space,
 	 * Ensure we have enough slack memory to guarantee
 	 * successful statement-level rollback.
 	 */
-	memtx_index_extent_reserve(RESERVE_EXTENTS_BEFORE_REPLACE);
+	memtx_index_extent_reserve(new_tuple ?
+				   RESERVE_EXTENTS_BEFORE_REPLACE :
+				   RESERVE_EXTENTS_BEFORE_DELETE);
 	uint32_t i = 0;
 	try {
 		/* Update the primary key */
-- 
GitLab