[PATCH 3/3] vinyl: remove unused error injection handling in cache

Vladimir Davydov vdavydov.dev at gmail.com
Mon Feb 26 20:47:12 MSK 2018


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 121a4263..af8ff267 100644
--- a/src/box/vy_cache.c
+++ b/src/box/vy_cache.c
@@ -661,12 +661,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;
@@ -703,12 +697,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);
 
 	/*
@@ -771,16 +759,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);
 
-- 
2.11.0




More information about the Tarantool-patches mailing list