From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 45BB76AAB1; Thu, 20 May 2021 12:03:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 45BB76AAB1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621501423; bh=+emAedFUXsMICaIEz3t3f9ok0ADzjDaxSs54jFdSG+k=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ppROlsOVloF0h3/vb5Mo0kJ+6n41Z+2No6Uc2aFlpfFCbIOicfM/D14hp8R8mnxet Hyrx1j6lnpRsV0j27wmBspag54TvDYRDkUrGSESTRhAo++rb2Ljs0d5pceogwjBBf0 D/Ux78fBI1MDvCFdVf7Q+/B3vJNytC/eyLOmsS6g= Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 433106AAB1 for ; Thu, 20 May 2021 12:02:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 433106AAB1 Received: by smtp52.i.mail.ru with esmtpa (envelope-from ) id 1ljeZl-0000ap-LJ; Thu, 20 May 2021 12:02:42 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Thu, 20 May 2021 12:02:35 +0300 Message-Id: <45cf1226095c865bc77274805260d42915913140.1621501007.git.sergepetrenko@tarantool.org> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD91B019B01C53E51AF9418A6087D01078917D63D7C0371164600894C459B0CD1B9B96B85EBD1EB68184B08E04D3DEF4D56377725EC486409A2D599AB4818251001 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7ECD3FEFFF0C7120DC2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7C845A4BF0BB3D210EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BD6CF32B5F8F9D40443FCB104735F84619236E48E2E738528CC7F00164DA146DAFE8445B8C89999728AA50765F79006377C70927E34808485389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC86089696B24BB1D19F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C735DFC8FA7AC120703F1AB874ED890284AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C35E28C88643C8D1FABA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7BB1D8AFE8C29F51C731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8183A4AFAF3EA6BDC44C234C8B12C006B7A289833858AF3DF23E099F3B482AAC00808039221B1AF0CA8B1881A6453793CE9C32612AADDFBE061C801D989C91DAA47C32612AADDFBE061708429AC48BF55216DABF04D5057A81F728CF7B057D10C70CE135D2742255B35B936CB490224F2464EEA7BD89490CAC0EDDA962BC3F61961 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34087368DEEB028F17136AC680A076360E3956288C4BB9CD8A908252C2328B6A4EEC4D90D40CF5AE3E1D7E09C32AA3244C9F571634271F010E090434BFCAF00BCAB4DF56057A86259F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXjRs6glMQaGnksvq4Dve/de X-Mailru-Sender: 583F1D7ACE8F49BD95918038521BA2AAB49FED91A72D1289457FBBCAC79822DB4C0D8064E55E0323424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH 2/3] txn_limbo: move lsn assignment to journal completion callback X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Previously local lsn assignment for txn_limbo entries was done right in txn_commit() body after the WAL write. In order to make the entries lsn available to on_wal_write triggers, which are called from the journal completion callback, assign it right in the callback before the triggers are called. Note, ACKing the entry is not moved to journal completion callback, since it may trigger writing CONFIRM, which cannot be done from the sched fiber (which executes the journal callback). Prerequisite #6032 --- src/box/txn.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/box/txn.c b/src/box/txn.c index 1fa3e4367..dea824d78 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -545,6 +545,16 @@ txn_on_journal_write(struct journal_entry *entry) txn_complete_fail(txn); goto finish; } + + if (txn_has_flag(txn, TXN_WAIT_ACK) && txn->limbo_entry->lsn == -1) { + int64_t lsn = entry->rows[entry->n_rows - 1]->lsn; + /* + * Must be a local entry since its lsn wasn't known prior to + * the WAL write. + */ + txn_limbo_assign_local_lsn(&txn_limbo, txn->limbo_entry, lsn); + } + double stop_tm = ev_monotonic_now(loop()); double delta = stop_tm - txn->start_tm; if (delta > too_long_threshold) { @@ -906,13 +916,6 @@ txn_commit(struct txn *txn) if (is_sync) { if (txn_has_flag(txn, TXN_WAIT_ACK)) { int64_t lsn = req->rows[req->n_rows - 1]->lsn; - /* - * Use local LSN assignment. Because - * blocking commit is used by local - * transactions only. - */ - txn_limbo_assign_local_lsn(&txn_limbo, txn->limbo_entry, - lsn); /* Local WAL write is a first 'ACK'. */ txn_limbo_ack(&txn_limbo, txn_limbo.owner_id, lsn); } -- 2.30.1 (Apple Git-130)