From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (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 BA5BB469719 for ; Tue, 15 Sep 2020 10:53:55 +0300 (MSK) References: <341cec180dc7ffda2f7d8cf03f8adfb03658694f.1600124767.git.v.shpilevoy@tarantool.org> From: Serge Petrenko Message-ID: Date: Tue, 15 Sep 2020 10:53:54 +0300 MIME-Version: 1.0 In-Reply-To: <341cec180dc7ffda2f7d8cf03f8adfb03658694f.1600124767.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH v2 1/4] xlog: introduce an error code for XlogGapError List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com 15.09.2020 02:11, Vladislav Shpilevoy пишет: > XlogGapError object didn't have a code in ClientError code space. > Because of that it was not possible to handle the gap error > together with client errors in some switch-case statement. > > Now the gap error has a code. > > This is going to be used in applier code to handle XlogGapError > among other errors using its code instead of RTTI. > > Needed for #5287 > --- > src/box/errcode.h | 1 + > src/box/error.cc | 2 ++ > src/box/error.h | 1 + > src/box/recovery.h | 2 -- > test/box/error.result | 1 + > 5 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/box/errcode.h b/src/box/errcode.h > index 3c21375f5..9a240a431 100644 > --- a/src/box/errcode.h > +++ b/src/box/errcode.h > @@ -271,6 +271,7 @@ struct errcode_record { > /*216 */_(ER_SYNC_QUORUM_TIMEOUT, "Quorum collection for a synchronous transaction is timed out") \ > /*217 */_(ER_SYNC_ROLLBACK, "A rollback for a synchronous transaction is received") \ > /*218 */_(ER_TUPLE_METADATA_IS_TOO_BIG, "Can't create tuple: metadata size %u is too big") \ > + /*219 */_(ER_XLOG_GAP, "%s") \ > > /* > * !IMPORTANT! Please follow instructions at start of the file > diff --git a/src/box/error.cc b/src/box/error.cc > index c3c2af3ab..ca1d73e0c 100644 > --- a/src/box/error.cc > +++ b/src/box/error.cc > @@ -221,6 +221,8 @@ ClientError::get_errcode(const struct error *e) > return ER_SYSTEM; > if (type_cast(CollationError, e)) > return ER_CANT_CREATE_COLLATION; > + if (type_cast(XlogGapError, e)) > + return ER_XLOG_GAP; > return ER_PROC_LUA; > } > > diff --git a/src/box/error.h b/src/box/error.h > index 988b98255..338121dd9 100644 > --- a/src/box/error.h > +++ b/src/box/error.h > @@ -178,6 +178,7 @@ box_error_new(const char *file, unsigned line, uint32_t code, > > extern const struct type_info type_ClientError; > extern const struct type_info type_XlogError; > +extern const struct type_info type_XlogGapError; > extern const struct type_info type_AccessDeniedError; > extern const struct type_info type_CustomError; > > diff --git a/src/box/recovery.h b/src/box/recovery.h > index 6e68abc0b..b8d83951a 100644 > --- a/src/box/recovery.h > +++ b/src/box/recovery.h > @@ -40,8 +40,6 @@ > extern "C" { > #endif /* defined(__cplusplus) */ > > -extern const struct type_info type_XlogGapError; > - > struct xrow_header; > struct xstream; > > diff --git a/test/box/error.result b/test/box/error.result > index cdecdb221..600517316 100644 > --- a/test/box/error.result > +++ b/test/box/error.result > @@ -437,6 +437,7 @@ t; > | 216: box.error.SYNC_QUORUM_TIMEOUT > | 217: box.error.SYNC_ROLLBACK > | 218: box.error.TUPLE_METADATA_IS_TOO_BIG > + | 219: box.error.XLOG_GAP > | ... > > test_run:cmd("setopt delimiter ''"); LGTM -- Serge Petrenko