MCPcopy Create free account
hub / github.com/apple/foundationdb / shutdown

Method shutdown

fdbserver/DiskQueue.actor.cpp:596–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594 }
595
596 ACTOR static void shutdown(RawDiskQueue_TwoFiles* self, bool deleteFiles) {
597 // Wait for all reads and writes on the file, and all actors referencing self, to be finished
598 state Error error = success();
599 try {
600 wait(success(errorOr(self->lastCommit)));
601 // Wait for the pending operations (e.g., read) to finish before we destroy the DiskQueue, because
602 // tLog, instead of DiskQueue, hold the future of the pending operations.
603 wait(self->onSafeToDestruct());
604
605 for (int i = 0; i < 2; i++)
606 self->files[i].f.clear();
607
608 if (deleteFiles) {
609 TraceEvent("DiskQueueShutdownDeleting", self->dbgid)
610 .detail("File0", self->filename(0))
611 .detail("File1", self->filename(1));
612 wait(IAsyncFileSystem::filesystem()->incrementalDeleteFile(self->filename(0), false));
613 wait(IAsyncFileSystem::filesystem()->incrementalDeleteFile(self->filename(1), true));
614 }
615 TraceEvent("DiskQueueShutdownComplete", self->dbgid)
616 .detail("DeleteFiles", deleteFiles)
617 .detail("File0", self->filename(0));
618 } catch (Error& e) {
619 TraceEvent(SevError, "DiskQueueShutdownError", self->dbgid)
620 .errorUnsuppressed(e)
621 .detail("Reason", e.code() == error_code_platform_error ? "could not delete database" : "unknown");
622 error = e;
623 }
624
625 if (error.code() != error_code_actor_cancelled) {
626 if (self->stopped.canBeSet())
627 self->stopped.send(Void());
628 if (self->error.canBeSet())
629 self->error.send(Never());
630 delete self;
631 }
632 }
633
634 // Return the most recently written page, the page with largest seq number
635 ACTOR static UNCANCELLABLE Future<Standalone<StringRef>> readFirstAndLastPages(RawDiskQueue_TwoFiles* self,

Callers 1

closeSocketFunction · 0.45

Calls 12

filenameMethod · 0.95
errorOrFunction · 0.85
TraceEventClass · 0.85
onSafeToDestructMethod · 0.80
detailMethod · 0.80
incrementalDeleteFileMethod · 0.80
clearMethod · 0.65
VoidClass · 0.50
NeverClass · 0.50
codeMethod · 0.45
canBeSetMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected