From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 11 Jun 2019 17:14:50 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v3 04/14] ddl: place alter structures onto a txn memory region Message-ID: <20190611141450.2pz55whw7m24p6q4@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Georgy Kirichenko Cc: tarantool-patches@freelists.org List-ID: 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.