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 16CB16EC40; Mon, 9 Aug 2021 13:41:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 16CB16EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628505660; bh=dRDj3xyE2nBgiCgPaCw1cudgI6sDh6eDS+bqJGnfPQ8=; 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=J7zMjtoPQmseQDD4jjKZLLUZOAQeg3pGA00ayx8XHg6sxZioW1Qxy1PAxvO50PLk7 ZR+WZbfos2NnDhz9IN+Hcwk4VTyYjI5MmzzDvFApPQaU+vJruHN7Pl591Je9IYGBlj yRHayw2LrQmeMZl7272LK6hqaHs6Vx3Iho/bkblQ= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 74B7F6EC40 for ; Mon, 9 Aug 2021 13:40:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 74B7F6EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mD2hp-0000A3-R0; Mon, 09 Aug 2021 13:40:30 +0300 To: tarantool-patches@dev.tarantool.org Date: Mon, 9 Aug 2021 13:40:28 +0300 Message-Id: <5850df69f9f8f9fadc7cb85d53b75c9d79c7ff46.1628505014.git.vdavydov@tarantool.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <2d5889e419f7c6a35d1c4394a42b0f4b5ff62a68.1628505014.git.vdavydov@tarantool.org> References: <2d5889e419f7c6a35d1c4394a42b0f4b5ff62a68.1628505014.git.vdavydov@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9736CF3E71F18CE0C3E1D5927724F4AAA182A05F538085040215700313A4A39323341B305369DD287130369092E70283C42DC584469E13534 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE779AAD18609327F83EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CFA2FDEB3954FDBC8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F7793776CC2238718976ED41091F2258117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCC493A577044FAF45A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520C65AC60A1F0286FE28451B159A507268D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6B1CFA6D474D4A6A4089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8183A4AFAF3EA6BDC44C234C8B12C006B7A9B153E7E74613C93F999C90AB454771223AFBF05C51D19F7B1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDBC64BFC3B5CB3D1D1DC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340B06C327CE4A70E87487ED25A7E2B33F7C996A17030AA551B504C62BA4847F8BFDE8E63777289FEE1D7E09C32AA3244C1C36FEAA8A18257325F31A5575E536A8B038C9161EF167A1927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGhQhWEp1aB/P82ot7KVO/A== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DA20022B3BFB880E29AFE099B7E4989C1274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 2/2] 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: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Cc: v.shpilevoy@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --- https://github.com/tarantool/tarantool/tree/vdavydov/iproto-clear-request-header 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 5cc69b77ff93..dcf60e1be099 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 0f2fcf94acfc..48b8b55f5e9b 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.25.1