From 88eed268c3d44a75d79efb9d7aa472f9c5908991 Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Sun, 11 Jun 2023 16:10:20 -0700 Subject: [PATCH] added a knob for how many bytes are read from disk --- fdbclient/ClientKnobs.cpp | 1 + fdbclient/NativeAPI.actor.cpp | 8 ++++++-- fdbclient/include/fdbclient/ClientKnobs.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fdbclient/ClientKnobs.cpp b/fdbclient/ClientKnobs.cpp index bca7cf562c..dd7da1d677 100644 --- a/fdbclient/ClientKnobs.cpp +++ b/fdbclient/ClientKnobs.cpp @@ -86,6 +86,7 @@ void ClientKnobs::initialize(Randomize randomize) { init( CHANGE_FEED_COALESCE_LOCATIONS, true ); if( randomize && BUGGIFY ) CHANGE_FEED_COALESCE_LOCATIONS = false; init( CHANGE_FEED_CACHE_FLUSH_BYTES, 10e6 ); if( randomize && BUGGIFY ) CHANGE_FEED_CACHE_FLUSH_BYTES = deterministicRandom()->randomInt64(1, 1e6); init( CHANGE_FEED_CACHE_EXPIRE_TIME, 60.0 ); if( randomize && BUGGIFY ) CHANGE_FEED_CACHE_EXPIRE_TIME = 1.0; + init( CHANGE_FEED_CACHE_LIMIT_BYTES, 500000 ); if( randomize && BUGGIFY ) CHANGE_FEED_CACHE_LIMIT_BYTES = 50000; init( MAX_BATCH_SIZE, 1000 ); if( randomize && BUGGIFY ) MAX_BATCH_SIZE = 1; init( GRV_BATCH_TIMEOUT, 0.005 ); if( randomize && BUGGIFY ) GRV_BATCH_TIMEOUT = 0.1; diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 4250950b2f..f122e09882 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -9567,7 +9567,9 @@ ACTOR Future cleanupChangeFeedCache(DatabaseContext* db) { ACTOR Future initializeCFCache(DatabaseContext* db) { state Key beginKey = changeFeedCacheFeedKeys.begin; loop { - RangeResult res = wait(db->storage->readRange(KeyRangeRef(beginKey, changeFeedCacheFeedKeys.end), 5e5, 5e5)); + RangeResult res = wait(db->storage->readRange(KeyRangeRef(beginKey, changeFeedCacheFeedKeys.end), + CLIENT_KNOBS->CHANGE_FEED_CACHE_LIMIT_BYTES, + CLIENT_KNOBS->CHANGE_FEED_CACHE_LIMIT_BYTES)); if (res.size()) { beginKey = keyAfter(res.back().key); } else { @@ -10697,7 +10699,9 @@ ACTOR Future getChangeFeedStreamFromDisk(Reference db, loop { Key beginKey = changeFeedCacheKey(tenantPrefix, rangeID, range, *begin); Key endKey = changeFeedCacheKey(tenantPrefix, rangeID, range, MAX_VERSION); - state RangeResult res = wait(db->storage->readRange(KeyRangeRef(beginKey, endKey), 5e5, 5e5)); + state RangeResult res = wait(db->storage->readRange(KeyRangeRef(beginKey, endKey), + CLIENT_KNOBS->CHANGE_FEED_CACHE_LIMIT_BYTES, + CLIENT_KNOBS->CHANGE_FEED_CACHE_LIMIT_BYTES)); state int idx = 0; while (!foundEnd && idx < res.size()) { diff --git a/fdbclient/include/fdbclient/ClientKnobs.h b/fdbclient/include/fdbclient/ClientKnobs.h index 0cb5e46db3..92634f7598 100644 --- a/fdbclient/include/fdbclient/ClientKnobs.h +++ b/fdbclient/include/fdbclient/ClientKnobs.h @@ -82,6 +82,7 @@ public: bool CHANGE_FEED_COALESCE_LOCATIONS; int64_t CHANGE_FEED_CACHE_FLUSH_BYTES; double CHANGE_FEED_CACHE_EXPIRE_TIME; + int64_t CHANGE_FEED_CACHE_LIMIT_BYTES; int MAX_BATCH_SIZE; double GRV_BATCH_TIMEOUT;