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 043FE6EC40; Thu, 12 Aug 2021 12:53:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 043FE6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628762004; bh=YPajeFqZwbeFGWrQKwNckia5A3hxRA0OoQQV2PHN8Uc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Dc8/EetMkd85MBveFFjBAg6ED133qcsVBpy9uGW/AZHnVqRUxr6NUJM8anOHij9vM WP/KE3sdiOuuMw1OY/OfqJEXwLuRrrgz3p5XZSiDyu1vx53jpx8+cyx66E7cWzetp8 uP3Xx+gSuMhlYTmxYkQei6ViVcbn33Wxo4sr1eac= Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (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 209146EC40 for ; Thu, 12 Aug 2021 12:50:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 209146EC40 Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1mE7MO-0005NV-N2; Thu, 12 Aug 2021 12:50:49 +0300 To: tarantool-patches@dev.tarantool.org, vdavydov@tarantool.org, v.shpilevoy@tarantool.org Date: Thu, 12 Aug 2021 12:50:39 +0300 Message-Id: <2d2e87ffcd6ea5306eb2242c27ce737c28c5cedb.1628759886.git.mechanik20051988@tarantool.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9ECFD080E047A606F56291F8739A291D6182A05F538085040D188B6F7A82E6DC4A2584CD245EEAF8E5D084433D9B0FC57AF6A035C479D321F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BCC85671EC7A750CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063727C65896DA7AF7D78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8A4A741A794FDD08A4B91B3DFDDC35010117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC081CF0AE924DC023A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520599709FD55CB46A6F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C684D5A5F288D3D4BC0837EA9F3D197644AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C38BD8D02BBC31AAF5BA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE71B8D961A28FB0488731C566533BA786AA5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505D6C3EEE6BC5FD6D51AA8FF7CD5BC230B X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8183A4AFAF3EA6BDC44C234C8B12C006B7AB673E04388D63C48CB018543C0891AC1FD7E380575F1438CB1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDB6D77D8F98F67F34EDC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F05B761BB9C2AA44E9A2DEC9FD2AB86F0A6A01BC4484164654EF2D0783F1576F33834152D39D98051D7E09C32AA3244CF8D1E684EA2968993642D5365A2A39F697FE24653F78E668FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojKW4rnL99YhLpuwS8bJ0EQQ== X-Mailru-Sender: 583F1D7ACE8F49BD29FC049B2A5BF96395EA2367FC8BA7F5A6BEBCA594BC892CC4627B3BD372EAD2B79567116EAC6FCF4E830D9205DBEA545646F0D3C63A617F27ACC94E9A535D22112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 2/9] iproto: clear request::header for client requests 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: mechanik20051988 via Tarantool-patches Reply-To: mechanik20051988 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Vladimir Davydov To apply a client request, we only need to know its type and body. All the meta information, such as LSN, TSN, or replica id, must be set by WAL. Currently, however, it isn't necessarily true: iproto leaves a request header received over iproto as is, and tx will reuse the header instead of allocating a new one in this case, which is needed to process replication requests, see txn_add_redo(). Unless a client actually sets one of those meta fields, this causes no problems. However, if we added transaction support to the replication protocol, reusing the header would result in broken xlog, because currently, all requests received over iproto have the is_commit field set in xrow_header for the lack of TSN, while is_commit must only be set for the final statement in a transaction. One way to fix it would be clearing is_commit explicitly in iproto, but ignoring the whole header received over iproto looks more logical and error-proof. Needed for #5860 --- src/box/iproto.cc | 6 ++++++ src/box/xrow.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 5cc69b77f..dcf60e1be 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -1264,6 +1264,12 @@ iproto_msg_decode(struct iproto_msg *msg, const char **pos, const char *reqend, if (xrow_decode_dml(&msg->header, &msg->dml, dml_request_key_map(type))) goto error; + /* + * In contrast to replication requests, for a client request + * the xrow header is set by WAL, which generates LSNs and sets + * replica id. Ignore the header received over network. + */ + msg->dml.header = NULL; assert(type < sizeof(iproto_thread->dml_route) / sizeof(*(iproto_thread->dml_route))); cmsg_init(&msg->base, iproto_thread->dml_route[type]); diff --git a/src/box/xrow.h b/src/box/xrow.h index 0f2fcf94a..48b8b55f5 100644 --- a/src/box/xrow.h +++ b/src/box/xrow.h @@ -163,7 +163,7 @@ struct request { /* * Either log row, or network header, or NULL, depending * on where this packet originated from: the write ahead - * log/snapshot, client request, or a Lua request. + * log/snapshot, repliation, or a client request. */ struct xrow_header *header; /** -- 2.20.1