From: Konstantin Osipov <kostja@tarantool.org> To: tarantool-patches@freelists.org Cc: Georgy Kirichenko <georgy@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v2 3/8] Get rid of fiber_gc from txn_rollback Date: Fri, 31 May 2019 22:27:31 +0300 [thread overview] Message-ID: <20190531192731.GB6141@atlas> (raw) In-Reply-To: <5ee05038bc2ce46018425081245bf46df90415d6.1558598679.git.georgy@tarantool.org> * Georgy Kirichenko <georgy@tarantool.org> [19/05/23 12:14]: > diff --git a/src/box/box.cc b/src/box/box.cc > index 2a738fa36..4d6515dd4 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -197,7 +197,7 @@ box_process_rw(struct request *request, struct space *space, > return txn_commit_stmt(txn, request); > /* Autocommit mode. */ > if (txn_commit_stmt(txn, request) != 0) { > - txn_rollback(); > + txn_rollback(txn); Please add fiber_gc() here. > return -1; > } > if (txn_commit(txn) != 0) > --- a/src/box/call.c > +++ b/src/box/call.c > @@ -209,13 +209,17 @@ box_process_call(struct call_request *request, struct port *port) > fiber_set_user(fiber(), orig_credentials); > > if (rc != 0) { > - txn_rollback(); > + if (in_txn() != NULL) > + txn_rollback(in_txn()); > + fiber_gc(); > return -1; > } > > if (in_txn()) { > diag_set(ClientError, ER_FUNCTION_TX_ACTIVE); > - txn_rollback(); > + if (in_txn() != NULL) > + txn_rollback(in_txn()); in_txn() is expensive and can not be optimzied out, please use a local variable. > + fiber_gc(); > return -1; > } > > @@ -230,13 +234,17 @@ box_process_eval(struct call_request *request, struct port *port) > if (access_check_universe(PRIV_X) != 0) > return -1; > if (box_lua_eval(request, port) != 0) { > - txn_rollback(); > + if (in_txn() != NULL) > + txn_rollback(in_txn()); > + fiber_gc(); Same here and in other places. > return -1; > } > > index 87fd8b3bc..f677e1d33 100644 > --- a/src/box/txn.c > +++ b/src/box/txn.c > @@ -395,7 +395,7 @@ txn_commit(struct txn *txn) > if (txn->n_new_rows + txn->n_applier_rows > 0) { > txn->signature = txn_write_to_wal(txn); > if (txn->signature < 0) > - goto fail; > + return -1; Why this change? > } > /* > * The transaction is in the binary log. No action below > @@ -423,7 +423,7 @@ txn_commit(struct txn *txn) > txn_free(txn); > return 0; > fail: > - txn_rollback(); > + txn_rollback(txn); > return -1; > } > > @@ -437,11 +437,9 @@ txn_rollback_stmt(struct txn *txn) > } > > @@ -534,11 +530,14 @@ int > box_txn_rollback() > { > struct txn *txn = in_txn(); > + if (txn == NULL) > + return 0; > if (txn && txn->in_sub_stmt) { > diag_set(ClientError, ER_ROLLBACK_IN_SUB_STMT); > return -1; > } > - txn_rollback(); /* doesn't throw */ > + txn_rollback(txn); /* doesn't throw */ > + fiber_gc(); box_txn_rollback() is used in a bunch of places in sql. please fix it to use txn_rollback() and an explicit fiber_gc as well in a follow up patch. Thanks! -- Konstantin Osipov, Moscow, Russia
next prev parent reply other threads:[~2019-05-31 19:27 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-23 8:19 [tarantool-patches] [PATCH v2 0/8] Make transaction autonomous from a fiber internals Georgy Kirichenko 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 1/8] Encode a dml statement to a transaction memory region Georgy Kirichenko 2019-05-28 1:21 ` [tarantool-patches] " Kirill Yukhin 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 2/8] Get rid of autocommit from a txn structure Georgy Kirichenko 2019-05-27 20:51 ` [tarantool-patches] " Konstantin Osipov 2019-05-31 19:21 ` Konstantin Osipov 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 3/8] Get rid of fiber_gc from txn_rollback Georgy Kirichenko 2019-05-31 19:27 ` Konstantin Osipov [this message] 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 4/8] Remove fiber from a journal_entry structure Georgy Kirichenko 2019-05-31 19:29 ` [tarantool-patches] " Konstantin Osipov 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 5/8] Commit engine before all triggers Georgy Kirichenko 2019-05-31 19:32 ` [tarantool-patches] " Konstantin Osipov 2019-06-03 8:07 ` Георгий Кириченко 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 6/8] Offload tx_prio processing to a fiber Georgy Kirichenko 2019-05-31 19:36 ` [tarantool-patches] " Konstantin Osipov 2019-06-03 8:04 ` Георгий Кириченко 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 7/8] Enable asyncronous wal writes Georgy Kirichenko 2019-05-31 19:41 ` [tarantool-patches] " Konstantin Osipov 2019-06-03 8:09 ` Георгий Кириченко 2019-05-23 8:19 ` [tarantool-patches] [PATCH v2 8/8] Introduce asynchronous txn commit Georgy Kirichenko 2019-05-31 19:43 ` [tarantool-patches] " Konstantin Osipov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190531192731.GB6141@atlas \ --to=kostja@tarantool.org \ --cc=georgy@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v2 3/8] Get rid of fiber_gc from txn_rollback' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox