[Tarantool-patches] [PATCH v2 1/4] xlog: introduce an error code for XlogGapError
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Sep 15 02:11:27 MSK 2020
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 ''");
--
2.21.1 (Apple Git-122.3)
More information about the Tarantool-patches
mailing list