From 2ecaf2fcec550b674f2ed38163ffdd1b922ade95 Mon Sep 17 00:00:00 2001
From: Vladimir Davydov <vdavydov@tarantool.org>
Date: Tue, 16 Aug 2022 11:29:45 +0300
Subject: [PATCH] sequence: replace assertion with diag in
 sequence_data_iterator_create

We aren't planning to support all iterator types for _sequence read
views, but once we implement a Lua API for read views, the user will
still be able to create a read view of this space. So let's replace
the assertions with a graceful error.

Needed for https://github.com/tarantool/tarantool-ee/issues/197

NO_DOC=internal
NO_TEST=ee
NO_CHANGELOG=internal
---
 src/box/sequence.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/box/sequence.c b/src/box/sequence.c
index 9db36fe7c3..4fcd487232 100644
--- a/src/box/sequence.c
+++ b/src/box/sequence.c
@@ -361,10 +361,11 @@ sequence_data_iterator_create(struct index_read_view *base,
 			      enum iterator_type type,
 			      const char *key, uint32_t part_count)
 {
-	assert(type == ITER_ALL);
-	assert(key == NULL);
-	assert(part_count == 0);
-	(void)type;
+	if (type != ITER_ALL) {
+		diag_set(ClientError, ER_UNSUPPORTED,
+			 "_sequence_data read view", "requested iterator type");
+		return NULL;
+	}
 	(void)key;
 	(void)part_count;
 	struct sequence_data_read_view *rv =
-- 
GitLab