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 413EA6EC40; Mon, 9 Aug 2021 17:38:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 413EA6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628519919; 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=kKJoqP9YPt2VnQXX3Z2tEdZ7VfVtomL6KSXBSjpiAUr0Fr1NsNQZjumDW7+gDnPHu 3y5HnWatgJ+AUNcT40aLfYGa8f1WcOjo486CoJBvhT65FBracgdHy2aOjkBOi3LM+4 YCDy07rtiWAaa0uzy6zeAACXa+JfW+gtiMvIEzcM= Received: from smtp30.i.mail.ru (smtp30.i.mail.ru [94.100.177.90]) (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 4CC306EC40 for ; Mon, 9 Aug 2021 17:38:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4CC306EC40 Received: by smtp30.i.mail.ru with esmtpa (envelope-from ) id 1mD6Pk-0007bZ-AU; Mon, 09 Aug 2021 17:38:04 +0300 To: tarantool-patches@dev.tarantool.org, vdavydov@tarantool.org, v.shpilevoy@tarantool.org Date: Mon, 9 Aug 2021 17:37:56 +0300 Message-Id: <27dd02321f8ec2f8c7b8bfd160023d63a55fff08.1628519206.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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD910164DC12A5633065676A9727AC27C74182A05F538085040769CF5ED446DF726858296B87AF38549BE6FABE30CAEE22D9F62F9EF7B5C37B1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BCC85671EC7A750CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F28F4AF03526AA8F8638F802B75D45FF143C0E33DA2437434630C57BCD80B8176B668463F4F89F869C52D8A0A11E4004A6A07A72CF18B426A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE749E2213E709ACCBA9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3B30A456A8F293845117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFBBF7D358F828E8EFBA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6A67BD3AE6DBC366976E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C6898EBFCB5D2929543847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8183A4AFAF3EA6BDC44C234C8B12C006B7A693CA81D18FBDAD0F340ADF13B0B13EC27E73008D409469FB1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDBC64BFC3B5CB3D1D1DC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342B94C1DAF75C4D22F33B49C9A2986BD86A5B02B62D953799C7F9978C32D3EE49D54639135BF1D1C41D7E09C32AA3244C4475441BE2E44614B40FD4E878E07234408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGhQhWEp1aB9tFf2InH8ORw== X-Mailru-Sender: 583F1D7ACE8F49BD29FC049B2A5BF96391A1E5AAB912782F42004EED291C1890D26E8456A7AA1097B79567116EAC6FCF4E830D9205DBEA545646F0D3C63A617F27ACC94E9A535D22112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 2/8] 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