From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 14 Jun 2018 15:29:32 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v9 1/1] box: create bigrefs for tuples Message-ID: <20180614122932.ih7z2xc6x2gz7jqz@esperanza> References: <6e9f3cd4279c51bcee18508656a3e5a3738e4bde.1528976219.git.imeevma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6e9f3cd4279c51bcee18508656a3e5a3738e4bde.1528976219.git.imeevma@gmail.com> To: imeevma@tarantool.org Cc: tarantool-patches@freelists.org List-ID: On Thu, Jun 14, 2018 at 02:45:45PM +0300, imeevma@tarantool.org wrote: > diff --git a/src/box/box.cc b/src/box/box.cc > index c728a4c..4257861 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -174,20 +174,22 @@ process_rw(struct request *request, struct space *space, struct tuple **result) > txn_rollback_stmt(); > return -1; > } > + if (result == NULL) > + return txn_commit_stmt(txn, request); > + *result = tuple; > + if (tuple == NULL) > + return txn_commit_stmt(txn, request); > /* > * Pin the tuple locally before the commit, > * otherwise it may go away during yield in > * when WAL is written in autocommit mode. > */ > - TupleRefNil ref(tuple); > - if (txn_commit_stmt(txn, request) != 0) > - return -1; > - if (result != NULL) { > - if (tuple != NULL && tuple_bless(tuple) == NULL) > - return -1; > - *result = tuple; > - } > - return 0; > + tuple_ref(tuple); > + int rc = txn_commit_stmt(txn, request); > + if (rc == 0) > + tuple_bless(tuple); > + tuple_unref(tuple); > + return rc; As I mentioned before, I don't like the way you reworked this function workflow and squeezed this change into this particular patch, which has nothing to do with it. I don't really care though. Up to kostja@. > +/** Destroy big references and free memory that was allocated. */ > +static inline void > +bigref_list_destroy(void) > +{ > + free(bigref_list.refs); > + bigref_list_create(); No need to call 'create' on 'destroy' anymore. Please remove. Other than that, the patch looks good to me.