[Tarantool-patches] [PATCH v5 2/8] refactoring: specify struct name in allocation diagnostics

Sergey Ostanevich sergos at tarantool.org
Wed Nov 27 16:25:03 MSK 2019


Hi!

LGTM.

Sergos


On 22 Nov 05:46, Ilya Kosarev wrote:
> 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
> 


More information about the Tarantool-patches mailing list