From 91f5e938debde39a31ea227c855df49ba5a2cc79 Mon Sep 17 00:00:00 2001
From: Vladimir Davydov <vdavydov.dev@gmail.com>
Date: Mon, 26 Feb 2018 20:12:25 +0300
Subject: [PATCH] vinyl: remove unused error injection handling in cache

ERRINJ_VY_READ_PAGE and ERRINJ_VY_READ_PAGE_TIMEOUT injections are
used by vinyl/errinj test to check that a page read error is handled
properly. The cache checks if these injections are enabled and bails
out if so. Since commit a31c2c10347c ("vinyl: force read view in
iterator in autocommit mode"), this is not necessary, because cache
is not used unless SELECT is called from a transaction, and the above
mentioned test doesn't use transactions. So let's remove the checks.
If we ever enable cache for all SELECTs, we can disable cache in the
test with box.cfg.vinyl_cache instead of using error injections.
---
 src/box/vy_cache.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/src/box/vy_cache.c b/src/box/vy_cache.c
index b0e209e3cc..1c3e3692a4 100644
--- a/src/box/vy_cache.c
+++ b/src/box/vy_cache.c
@@ -665,12 +665,6 @@ vy_cache_iterator_next(struct vy_cache_iterator *itr,
 	*ret = NULL;
 	*stop = false;
 
-	/* disable cache for errinj test - let it try to read from disk */
-	ERROR_INJECT(ERRINJ_VY_READ_PAGE,
-		     { itr->search_started = true; return; });
-	ERROR_INJECT(ERRINJ_VY_READ_PAGE_TIMEOUT,
-		     { itr->search_started = true; return; });
-
 	if (!itr->search_started) {
 		assert(itr->curr_stmt == NULL);
 		itr->search_started = true;
@@ -707,12 +701,6 @@ vy_cache_iterator_skip(struct vy_cache_iterator *itr,
 	*ret = NULL;
 	*stop = false;
 
-	/* disable cache for errinj test - let it try to read from disk */
-	ERROR_INJECT(ERRINJ_VY_READ_PAGE,
-		     { itr->search_started = true; return; });
-	ERROR_INJECT(ERRINJ_VY_READ_PAGE_TIMEOUT,
-		     { itr->search_started = true; return; });
-
 	assert(!itr->search_started || itr->version == itr->cache->version);
 
 	/*
@@ -775,16 +763,6 @@ vy_cache_iterator_restore(struct vy_cache_iterator *itr,
 			  const struct tuple *last_stmt,
 			  struct tuple **ret, bool *stop)
 {
-	/* disable cache for errinj test - let it try to read from disk */
-	if ((errinj(ERRINJ_VY_READ_PAGE, ERRINJ_BOOL) != NULL &&
-	     errinj(ERRINJ_VY_READ_PAGE, ERRINJ_BOOL)->bparam) ||
-	    (errinj(ERRINJ_VY_READ_PAGE_TIMEOUT, ERRINJ_BOOL) != NULL &&
-	     errinj(ERRINJ_VY_READ_PAGE_TIMEOUT, ERRINJ_BOOL)->bparam)) {
-		*ret = NULL;
-		*stop = false;
-		return 0;
-	}
-
 	struct key_def *def = itr->cache->cmp_def;
 	int dir = iterator_direction(itr->iterator_type);
 
-- 
GitLab