[tarantool-patches] Re: [tarantool-patches] Re: [PATCH v4 05/20] refactoring: clear privilege managing triggers from exceptions

Ilya Kosarev i.kosarev at tarantool.org
Mon Oct 21 15:14:28 MSK 2019


Hi!

Thanks for your review.
I will fix it in v5.
Sincerely,
Ilya Kosarev


>Пятница, 18 октября 2019, 17:21 +03:00 от Sergey Ostanevich <sergos at tarantool.org>:
>
>Hi!
>
>On 23 Sep 18:56, Ilya Kosarev wrote:
>> modify_priv, revoke_priv & on_replace_dd_priv triggers are
>> cleared from exceptions. A list of functions: priv_def_check,
>> priv_def_create_from_tuple, user_grant_priv, user_reload_privs,
>> rebuild_effective_grants, grant_revoke, role_check, role_grant,
>> role_revoke, priv_grant, access_check_ddl & txn_alter_trigger_new
>> were also refactored to achieve it. Their usages are updated.
>> user_find_xc is removed as far as it is not needed anymore.
>> 
>> Part of #4247
>> ---
>>  src/box/alter.cc | 334 ++++++++++++++++++++++++++++++++++-------------
>>  src/box/user.cc  |  79 +++++++----
>>  src/box/user.h   |  20 +--
>>  3 files changed, 303 insertions(+), 130 deletions(-)
>> 
>> diff --git a/src/box/alter.cc b/src/box/alter.cc
>> index d4cb9e8d8..85304c47d 100644
>[...]
>
>> @@ -708,8 +710,15 @@ public:
>>  static struct trigger *
>>  txn_alter_trigger_new(trigger_f run, void *data)
>>  {
>> +	size_t size = sizeof(struct trigger);
>>  	struct trigger *trigger = (struct trigger *)
>> -		region_calloc_object_xc(&in_txn()->region, struct trigger);
>> +		region_aligned_alloc(&in_txn()->region, size,
>> +				     alignof(struct trigger));
>> +	if (trigger == NULL) {
>> +		diag_set(OutOfMemory, size, "region", "new slab");
>> +		return NULL;
>> +	}
>> +	trigger = (struct trigger *)memset(trigger, 0, size);
>>  	trigger->run = run;
>>  	trigger->data = data;
>>  	trigger->destroy = NULL;
>
>After memset of the whole struct there's no need in NULL for the field.
>Although, I believe contemporary compiller will expand the memset and remove this.
>
>Otherwise LGTM.
>
>Sergos
>
>


-- 
Ilya Kosarev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20191021/7f3bb556/attachment.html>


More information about the Tarantool-patches mailing list