diff --git a/fdbclient/ServerKnobs.cpp b/fdbclient/ServerKnobs.cpp index 3fda363c22..8693b1bd95 100644 --- a/fdbclient/ServerKnobs.cpp +++ b/fdbclient/ServerKnobs.cpp @@ -808,7 +808,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi init( REDWOOD_LAZY_CLEAR_MIN_PAGES, 0 ); init( REDWOOD_LAZY_CLEAR_MAX_PAGES, 1e6 ); init( REDWOOD_REMAP_CLEANUP_WINDOW_BYTES, 4LL * 1024 * 1024 * 1024 ); - init( REDWOOD_REMAP_CLEANUP_LAG, 0.1 ); + init( REDWOOD_REMAP_CLEANUP_TOLERANCE_RATIO, 0.05 ); init( REDWOOD_PAGEFILE_GROWTH_SIZE_PAGES, 20000 ); if( randomize && BUGGIFY ) { REDWOOD_PAGEFILE_GROWTH_SIZE_PAGES = deterministicRandom()->randomInt(200, 1000); } init( REDWOOD_METRICS_INTERVAL, 5.0 ); init( REDWOOD_HISTOGRAM_INTERVAL, 30.0 ); diff --git a/fdbclient/ServerKnobs.h b/fdbclient/ServerKnobs.h index 869900043c..322e912b37 100644 --- a/fdbclient/ServerKnobs.h +++ b/fdbclient/ServerKnobs.h @@ -756,8 +756,8 @@ public: // queue is empty int64_t REDWOOD_REMAP_CLEANUP_WINDOW_BYTES; // Total size of remapped pages to keep before being removed by // remap cleanup - double REDWOOD_REMAP_CLEANUP_LAG; // Maximum allowed remap remover lag behind the cleanup window as a multiple of - // the window size + double REDWOOD_REMAP_CLEANUP_TOLERANCE_RATIO; // Maximum ratio of the remap cleanup window that remap cleanup is + // allowed to be ahead or hehind int REDWOOD_PAGEFILE_GROWTH_SIZE_PAGES; // Number of pages to grow page file by double REDWOOD_METRICS_INTERVAL; double REDWOOD_HISTOGRAM_INTERVAL; diff --git a/fdbserver/VersionedBTree.actor.cpp b/fdbserver/VersionedBTree.actor.cpp index 6ea8961ba1..7d602d02de 100644 --- a/fdbserver/VersionedBTree.actor.cpp +++ b/fdbserver/VersionedBTree.actor.cpp @@ -3439,9 +3439,10 @@ public: state RemappedPage cutoff(oldestRetainedVersion); // Maximum number of remaining remap entries to keep before obeying stop command. - state uint64_t maxRemapEntries = - self->remapCleanupWindow * - (1 + (BUGGIFY ? deterministicRandom()->randomInt(0, 20) / 100.0 : SERVER_KNOBS->REDWOOD_REMAP_CLEANUP_LAG)); + double toleranceRatio = BUGGIFY ? deterministicRandom()->randomInt(0, 10) / 100.0 + : SERVER_KNOBS->REDWOOD_REMAP_CLEANUP_TOLERANCE_RATIO; + state uint64_t minRemapEntries = static_cast(self->remapCleanupWindow * (1.0 - toleranceRatio)); + state uint64_t maxRemapEntries = static_cast(self->remapCleanupWindow * (1.0 + toleranceRatio)); debug_printf("DWALPager(%s) remapCleanup oldestRetainedVersion=%" PRId64 " remapCleanupWindow=%" PRId64 " maxRemapEntries=%" PRId64 " items=%" PRId64 "\n", @@ -3460,13 +3461,13 @@ public: // Stop if we have cleanup enough remap entries, or if the stop flag is set and the remaining remap // entries are less than that allowed by the lag. int64_t remainingEntries = self->remapQueue.numEntries; - if (remainingEntries <= self->remapCleanupWindow || + if (remainingEntries <= minRemapEntries || (self->remapCleanupStop && remainingEntries <= maxRemapEntries)) { - debug_printf("DWALPager(%s) remapCleanup finished remainingEntries=%" PRId64 - " remapCleanupWindow=%" PRId64 " maxRemapEntries=%" PRId64, + debug_printf("DWALPager(%s) remapCleanup finished remainingEntries=%" PRId64 " minRemapEntries=%" PRId64 + " maxRemapEntries=%" PRId64, self->filename.c_str(), remainingEntries, - self->remapCleanupWindow, + minRemapEntries, maxRemapEntries); break; }