From 529264022d32ee411a1f5c0cd8f6884a416101d0 Mon Sep 17 00:00:00 2001
From: Ilya Verbin <iverbin@tarantool.org>
Date: Sat, 29 Jun 2024 18:04:26 +0300
Subject: [PATCH] error: introduce ERRINJ_TUPLE_ALLOC_COUNTDOWN

Needed for tarantool/tarantool-ee#712

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
---
 src/box/memtx_engine.cc | 4 ++++
 src/lib/core/errinj.h   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/box/memtx_engine.cc b/src/box/memtx_engine.cc
index af07eb96d9..5ea6a247fb 100644
--- a/src/box/memtx_engine.cc
+++ b/src/box/memtx_engine.cc
@@ -1841,6 +1841,10 @@ memtx_tuple_new_raw_impl(struct tuple_format *format, const char *data,
 		diag_set(OutOfMemory, total, "slab allocator", "memtx_tuple");
 		goto end;
 	});
+	ERROR_INJECT_COUNTDOWN(ERRINJ_TUPLE_ALLOC_COUNTDOWN, {
+		diag_set(OutOfMemory, total, "slab allocator", "memtx_tuple");
+		goto end;
+	});
 	if (unlikely(total > memtx->max_tuple_size)) {
 		diag_set(ClientError, ER_MEMTX_MAX_TUPLE_SIZE, total,
 			 memtx->max_tuple_size);
diff --git a/src/lib/core/errinj.h b/src/lib/core/errinj.h
index ab24373a20..b6a680b94f 100644
--- a/src/lib/core/errinj.h
+++ b/src/lib/core/errinj.h
@@ -141,6 +141,7 @@ struct errinj {
 	_(ERRINJ_SWIM_FD_ONLY, ERRINJ_BOOL, {.bparam = false}) \
 	_(ERRINJ_TESTING, ERRINJ_BOOL, {.bparam = false}) \
 	_(ERRINJ_TUPLE_ALLOC, ERRINJ_BOOL, {.bparam = false}) \
+	_(ERRINJ_TUPLE_ALLOC_COUNTDOWN, ERRINJ_INT, {.iparam = -1}) \
 	_(ERRINJ_TUPLE_FIELD, ERRINJ_BOOL, {.bparam = false}) \
         _(ERRINJ_TUPLE_FIELD_COUNT_LIMIT, ERRINJ_INT, {.iparam = -1}) \
 	_(ERRINJ_TUPLE_FORMAT_COUNT, ERRINJ_INT, {.iparam = -1}) \
-- 
GitLab