From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 387DE469719 for ; Tue, 3 Mar 2020 10:13:29 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) From: Chris Sosnin In-Reply-To: <20200302191845.GA2544@tarantool.org> Date: Tue, 3 Mar 2020 10:13:26 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <91563624-92C3-45A7-8007-95FD0B248E3C@tarantool.org> References: <20200302163733.15036-1-k.sosnin@tarantool.org> <20200302191845.GA2544@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] iproto: add an empty body to the unprepare response List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org Hi! Thank you for the review! > 2 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2020 =D0=B3., =D0=B2 22:18, Nikita = Pettik =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB= (=D0=B0): >=20 > On 02 Mar 19:37, Chris Sosnin wrote: >> Yes, I was told that writing tests in python is kind of deprecated = thing, >> however this test fits here quite well and makes patch much more = concise. >=20 > Alternatively, you can introduce box/iproto.test.lua which will > be used for 'raw' iproto requests handling (e.g. to test raw iproto > requests containing new diagnostics area: > = https://github.com/tarantool/tarantool/commit/5779ae4b562df18e4ec2e6c88214= 41d0d507f8f4#diff-af67795b74dc02a6ae1eab64b8fa920cR12). > As a reference you can look at = gh-4077-iproto-execute-no-binds.test.lua This seems reasonable. Thanks, I will rework it and send a new version. > LGTM otherwise. >=20 >> diff --git a/src/box/iproto.cc b/src/box/iproto.cc >> index f313af6ae..d5891391d 100644 >> --- a/src/box/iproto.cc >> +++ b/src/box/iproto.cc >> @@ -1781,20 +1781,23 @@ tx_process_sql(struct cmsg *m) >> */ >> out =3D msg->connection->tx.p_obuf; >> struct obuf_svp header_svp; >> + if (is_unprepare) { >> + if (iproto_reply_ok(out, msg->header.sync, = schema_version) !=3D 0) >> + goto error; >> + iproto_wpos_create(&msg->wpos, out); >> + return; >> + } >> /* Prepare memory for the iproto header. */ >> if (iproto_prepare_header(out, &header_svp, IPROTO_HEADER_LEN) = !=3D 0) { >> port_destroy(&port); >> goto error; >> } >> - /* Nothing to dump in case of UNPREPARE request. */ >> - if (!is_unprepare) { >> - if (port_dump_msgpack(&port, out) !=3D 0) { >> - port_destroy(&port); >> - obuf_rollback_to_svp(out, &header_svp); >> - goto error; >> - } >> + if (port_dump_msgpack(&port, out) !=3D 0) { >> port_destroy(&port); >> + obuf_rollback_to_svp(out, &header_svp); >> + goto error; >> } >> + port_destroy(&port); >> iproto_reply_sql(out, &header_svp, msg->header.sync, = schema_version); >> iproto_wpos_create(&msg->wpos, out); >> return; >> diff --git a/test/box-py/iproto.test.py b/test/box-py/iproto.test.py >> index 77637d8ed..101e5e913 100644 >> --- a/test/box-py/iproto.test.py >> +++ b/test/box-py/iproto.test.py >> @@ -286,6 +286,20 @@ resp =3D test_request(header, body) >> print 'Schema changed -> error:', resp['header'][0] !=3D 0 >> print 'Got another schema_id:', resp['header'][5] !=3D schema_id >>=20 >> +# >> +# gh-4769 Unprepare response must have a body. >> +# >> +IPROTO_PREPARE =3D 13 >> +IPROTO_SQL_TEXT =3D 0x40 >> +IPROTO_STMT_ID =3D 0x43 >> + >> +header =3D { IPROTO_CODE : IPROTO_PREPARE } >> +body =3D { IPROTO_SQL_TEXT : 'SELECT 1' } >> +resp =3D test_request(header, body) >> + >> +body =3D { IPROTO_STMT_ID : resp['body'][IPROTO_STMT_ID] } >> +resp =3D test_request(header, body) >> + >> # >> # gh-2334 Lost SYNC in JOIN response. >> # >> --=20 >> 2.21.1 (Apple Git-122.3) >>=20