[tarantool-patches] [PATCH v3 04/14] ddl: place alter structures onto a txn memory region

Vladimir Davydov vdavydov.dev at gmail.com
Tue Jun 11 17:14:50 MSK 2019


On Sun, Jun 09, 2019 at 11:44:33PM +0300, Georgy Kirichenko wrote:
> As alter schema triggers lifecycle is bound with a transaction
> so corresponding structures should be placed onto a txn memory
> region instead of a fiber gc space.
> 
> Prerequisites: #1254
> ---
>  src/box/alter.cc |  8 ++++----
>  src/box/vinyl.c  | 10 ++++------
>  2 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index c4a1c52a9..671209b51 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -668,7 +668,7 @@ public:
>  
>  	void *operator new(size_t size)
>  	{
> -		return region_aligned_calloc_xc(&fiber()->gc, size,
> +		return region_aligned_calloc_xc(&in_txn()->region, size,
>  						alignof(uint64_t));
>  	}
>  	void operator delete(void * /* ptr */) {}
> @@ -682,7 +682,7 @@ static struct trigger *
>  txn_alter_trigger_new(trigger_f run, void *data)
>  {
>  	struct trigger *trigger = (struct trigger *)
> -		region_calloc_object_xc(&fiber()->gc, struct trigger);
> +		txn_alloc(in_txn(), sizeof(struct trigger));

I don't like that in some places you use in_txn()->region while in
others txn_alloc(). BTW you lost oom exception here.

I removed txn_alloc() in favor of accessing txn->region directly and
pushed this patch to master.



More information about the Tarantool-patches mailing list