Bug fix: In simulation, KVStoreSQLite can outlive its process during a simulated reboot so its file references must be cleared explicitly during shutdown instead of implicitly during destruction. Re-enabled a useful trace event. Some cleanup, removed unnecessary member var initializer and removed unnecessary method.

This commit is contained in:
Steve Atherton 2021-02-05 21:26:39 -08:00
parent 2521e74780
commit 8547abbbe4
2 changed files with 5 additions and 5 deletions

View File

@ -230,8 +230,6 @@ public:
return filename; return filename;
} }
std::vector<AFCPage*> const& getFlushable() { return flushable; }
void setRateControl(Reference<IRateControl> const& rc) override { rateControl = rc; } void setRateControl(Reference<IRateControl> const& rc) override { rateControl = rc; }
Reference<IRateControl> const& getRateControl() override { return rateControl; } Reference<IRateControl> const& getRateControl() override { return rateControl; }
@ -252,8 +250,8 @@ public:
} }
auto f = quiesce(); auto f = quiesce();
//TraceEvent("AsyncFileCachedDel").detail("Filename", filename) TraceEvent("AsyncFileCachedDel").detail("Filename", filename)
// .detail("Refcount", debugGetReferenceCount()).detail("CanDie", f.isReady()).backtrace(); .detail("Refcount", debugGetReferenceCount()).detail("CanDie", f.isReady()).backtrace();
if (f.isReady()) if (f.isReady())
delete this; delete this;
else else
@ -303,7 +301,7 @@ private:
AsyncFileCached(Reference<IAsyncFile> uncached, const std::string& filename, int64_t length, AsyncFileCached(Reference<IAsyncFile> uncached, const std::string& filename, int64_t length,
Reference<EvictablePageCache> pageCache) Reference<EvictablePageCache> pageCache)
: uncached(uncached), filename(filename), length(length), prevLength(length), pageCache(pageCache), : uncached(uncached), filename(filename), length(length), prevLength(length), pageCache(pageCache),
currentTruncate(Void()), currentTruncateSize(0), rateControl(nullptr) { currentTruncate(Void()), currentTruncateSize(0) {
if( !g_network->isSimulated() ) { if( !g_network->isSimulated() ) {
countFileCacheWrites.init(LiteralStringRef("AsyncFile.CountFileCacheWrites"), filename); countFileCacheWrites.init(LiteralStringRef("AsyncFile.CountFileCacheWrites"), filename);
countFileCacheReads.init(LiteralStringRef("AsyncFile.CountFileCacheReads"), filename); countFileCacheReads.init(LiteralStringRef("AsyncFile.CountFileCacheReads"), filename);

View File

@ -1897,6 +1897,7 @@ private:
dbFile->setRateControl({}); dbFile->setRateControl({});
rc->wakeWaiters(); rc->wakeWaiters();
} }
dbFile.clear();
if(walFile && walFile->getRateControl()) { if(walFile && walFile->getRateControl()) {
TraceEvent(SevDebug, "KeyValueStoreSQLiteShutdownRateControl").detail("Filename", walFile->getFilename()); TraceEvent(SevDebug, "KeyValueStoreSQLiteShutdownRateControl").detail("Filename", walFile->getFilename());
@ -1904,6 +1905,7 @@ private:
walFile->setRateControl({}); walFile->setRateControl({});
rc->wakeWaiters(); rc->wakeWaiters();
} }
walFile.clear();
} }
ACTOR static Future<Void> stopOnError( KeyValueStoreSQLite* self ) { ACTOR static Future<Void> stopOnError( KeyValueStoreSQLite* self ) {