Tarantool development patches archive
 help / color / mirror / Atom feed
From: Ilya Kosarev <i.kosarev@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v5 2/8] refactoring: specify struct name in allocation diagnostics
Date: Fri, 22 Nov 2019 05:46:50 +0300	[thread overview]
Message-ID: <5204e31ae0a6050f5d8202c61f2a5e0a75c6d9fb.1574390065.git.i.kosarev@tarantool.org> (raw)
In-Reply-To: <cover.1574390065.git.i.kosarev@tarantool.org>
In-Reply-To: <cover.1574390065.git.i.kosarev@tarantool.org>

In case of allocation problems in region alloc we were setting
diagnostics using "new slab" stub. Now we specify concrete struct name
which was going to be allocated.

Part of #4247
---
 src/box/alter.cc | 8 ++++----
 src/box/user.cc  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/box/alter.cc b/src/box/alter.cc
index 022c7dfa2..16e3f7d37 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -540,7 +540,7 @@ space_format_decode(const char *data, uint32_t *out_count,
 	struct field_def *region_defs =
 		(struct field_def *) region_alloc(region, size);
 	if (region_defs == NULL) {
-		diag_set(OutOfMemory, size, "region", "new slab");
+		diag_set(OutOfMemory, size, "region", "struct field_def");
 		return -1;
 	}
 	/*
@@ -810,7 +810,7 @@ txn_alter_trigger_new(trigger_f run, void *data)
 		region_aligned_alloc(&in_txn()->region, size,
 				     alignof(struct trigger));
 	if (trigger == NULL) {
-		diag_set(OutOfMemory, size, "region", "new slab");
+		diag_set(OutOfMemory, size, "region", "struct trigger");
 		return NULL;
 	}
 	trigger = (struct trigger *)memset(trigger, 0, size);
@@ -861,7 +861,7 @@ alter_space_new(struct space *old_space)
 		region_aligned_alloc(&in_txn()->region, size,
 				     alignof(struct alter_space));
 	if (alter == NULL) {
-		diag_set(OutOfMemory, size, "region", "new slab");
+		diag_set(OutOfMemory, size, "region", "struct alter_space");
 		return NULL;
 	}
 	alter = (struct alter_space *)memset(alter, 0, size);
@@ -4824,7 +4824,7 @@ decode_fk_links(struct tuple *tuple, uint32_t *out_count,
 	struct field_link *region_links =
 		(struct field_link *)region_alloc(&fiber()->gc, size);
 	if (region_links == NULL) {
-		diag_set(OutOfMemory, size, "region", "new slab");
+		diag_set(OutOfMemory, size, "region", "struct field_link");
 		return NULL;
 	}
 	memset(region_links, 0, size);
diff --git a/src/box/user.cc b/src/box/user.cc
index 39520f231..a012cb196 100644
--- a/src/box/user.cc
+++ b/src/box/user.cc
@@ -196,7 +196,7 @@ user_grant_priv(struct user *user, struct priv_def *def)
 		old = (struct priv_def *)
 			region_alloc(&user->pool, size);
 		if (old == NULL) {
-			diag_set(OutOfMemory, size, "region", "new slab");
+			diag_set(OutOfMemory, size, "region", "struct priv_def");
 			return -1;
 		}
 		*old = *def;
-- 
2.17.1

  parent reply	other threads:[~2019-11-22  2:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  2:46 [Tarantool-patches] [PATCH v5 0/8] refactoring: remove exceptions from triggers follow-ups Ilya Kosarev
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 1/8] refactoring: wrap new operator calls in triggers Ilya Kosarev
2019-11-26 15:07   ` Sergey Ostanevich
2019-11-22  2:46 ` Ilya Kosarev [this message]
2019-11-27 13:25   ` [Tarantool-patches] [PATCH v5 2/8] refactoring: specify struct name in allocation diagnostics Sergey Ostanevich
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 3/8] refactoring: recombine error conditions in triggers Ilya Kosarev
2019-11-27 13:28   ` Sergey Ostanevich
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 4/8] refactoring: set diagnostics if sequence_by_id fails Ilya Kosarev
2019-11-27 13:40   ` Sergey Ostanevich
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 5/8] refactoring: clear triggers from fresh exceptions Ilya Kosarev
2019-11-27 14:59   ` Sergey Ostanevich
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 6/8] refactoring: update comment for index_def_check_tuple Ilya Kosarev
2019-11-27 14:59   ` Sergey Ostanevich
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 7/8] refactoring: remove redundant line in txn_alter_trigger_new Ilya Kosarev
2019-11-27 15:00   ` Sergey Ostanevich
2019-11-22  2:46 ` [Tarantool-patches] [PATCH v5 8/8] refactoring: remove try..catch wrapper around trigger->run Ilya Kosarev
2019-11-27 15:01   ` Sergey Ostanevich
2019-12-02  7:41 ` [Tarantool-patches] [PATCH v5 0/8] refactoring: remove exceptions from triggers follow-ups Kirill Yukhin

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=5204e31ae0a6050f5d8202c61f2a5e0a75c6d9fb.1574390065.git.i.kosarev@tarantool.org \
    --to=i.kosarev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v5 2/8] refactoring: specify struct name in allocation diagnostics' \
    /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