Merge pull request #4161 from sfc-gh-satherton/fix-redwood-stack-overflow

Fix stack overflow in Redwood
This commit is contained in:
Jingyu Zhou 2020-12-21 13:48:52 -08:00 committed by GitHub
commit bac5b0404d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1837,6 +1837,7 @@ public:
state Version minStopVersion = cutoff.version - (BUGGIFY ? deterministicRandom()->randomInt(0, 10) : (self->remapCleanupWindow * SERVER_KNOBS->REDWOOD_REMAP_CLEANUP_LAG));
self->remapDestinationsSimOnly.clear();
state int sinceYield = 0;
loop {
state Optional<RemappedPage> p = wait(self->remapQueue.pop(cutoff));
debug_printf("DWALPager(%s) remapCleanup popped %s\n", self->filename.c_str(), ::toString(p).c_str());
@ -1855,6 +1856,11 @@ public:
if (self->remapCleanupStop && p.get().version >= minStopVersion) {
break;
}
if(++sinceYield >= 100) {
sinceYield = 0;
wait(yield());
}
}
debug_printf("DWALPager(%s) remapCleanup stopped (stop=%d)\n", self->filename.c_str(), self->remapCleanupStop);