Bug fix: Killing a machine process would not wait for AsyncFileNonDurable close operations to finish, causing a later reopen of the same file in a new process to hang forever. Renamed AsyncFileNonDurable::deleteFile to closeFile for clarity. Renamed Machine deletingFiles to deletingOrClosingFiles for clarity. (#7007)
This commit is contained in:
parent
504400c1b3
commit
338d2304d7
|
@ -276,7 +276,7 @@ public:
|
|||
if (delref_no_destroy()) {
|
||||
if (filesBeingDeleted.count(filename) == 0) {
|
||||
//TraceEvent("AsyncFileNonDurable_StartDelete", id).detail("Filename", filename);
|
||||
Future<Void> deleteFuture = deleteFile(this);
|
||||
Future<Void> deleteFuture = closeFile(this);
|
||||
if (!deleteFuture.isReady())
|
||||
filesBeingDeleted[filename] = deleteFuture;
|
||||
}
|
||||
|
@ -824,11 +824,13 @@ private:
|
|||
}
|
||||
|
||||
// Finishes all outstanding actors on an AsyncFileNonDurable and then deletes it
|
||||
ACTOR Future<Void> deleteFile(AsyncFileNonDurable* self) {
|
||||
ACTOR Future<Void> closeFile(AsyncFileNonDurable* self) {
|
||||
state ISimulator::ProcessInfo* currentProcess = g_simulator.getCurrentProcess();
|
||||
state TaskPriority currentTaskID = g_network->getCurrentTask();
|
||||
state std::string filename = self->filename;
|
||||
|
||||
g_simulator.getMachineByNetworkAddress(self->openedAddress)->deletingOrClosingFiles.insert(self->getFilename());
|
||||
|
||||
wait(g_simulator.onMachine(currentProcess));
|
||||
try {
|
||||
// Make sure all writes have gone through.
|
||||
|
@ -853,7 +855,8 @@ private:
|
|||
|
||||
// Remove this file from the filesBeingDeleted map so that new files can be created with this filename
|
||||
g_simulator.getMachineByNetworkAddress(self->openedAddress)->closingFiles.erase(self->getFilename());
|
||||
g_simulator.getMachineByNetworkAddress(self->openedAddress)->deletingFiles.erase(self->getFilename());
|
||||
g_simulator.getMachineByNetworkAddress(self->openedAddress)
|
||||
->deletingOrClosingFiles.erase(self->getFilename());
|
||||
AsyncFileNonDurable::filesBeingDeleted.erase(self->filename);
|
||||
//TraceEvent("AsyncFileNonDurable_FinishDelete", self->id).detail("Filename", self->filename);
|
||||
|
||||
|
|
|
@ -1147,7 +1147,7 @@ public:
|
|||
// for the existence of a non-durably deleted file BEFORE a reboot will show that it apparently doesn't exist.
|
||||
if (g_simulator.getCurrentProcess()->machine->openFiles.count(filename)) {
|
||||
g_simulator.getCurrentProcess()->machine->openFiles.erase(filename);
|
||||
g_simulator.getCurrentProcess()->machine->deletingFiles.insert(filename);
|
||||
g_simulator.getCurrentProcess()->machine->deletingOrClosingFiles.insert(filename);
|
||||
}
|
||||
if (mustBeDurable || deterministicRandom()->random01() < 0.5) {
|
||||
state ISimulator::ProcessInfo* currentProcess = g_simulator.getCurrentProcess();
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
// A map from filename to file handle for all open files on a machine
|
||||
std::map<std::string, UnsafeWeakFutureReference<IAsyncFile>> openFiles;
|
||||
|
||||
std::set<std::string> deletingFiles;
|
||||
std::set<std::string> deletingOrClosingFiles;
|
||||
std::set<std::string> closingFiles;
|
||||
Optional<Standalone<StringRef>> machineId;
|
||||
|
||||
|
|
|
@ -901,7 +901,7 @@ ACTOR Future<Void> simulatedMachine(ClusterConnectionString connStr,
|
|||
ASSERT(it.second.get().canGet());
|
||||
}
|
||||
|
||||
for (auto it : g_simulator.getMachineById(localities.machineId())->deletingFiles) {
|
||||
for (auto it : g_simulator.getMachineById(localities.machineId())->deletingOrClosingFiles) {
|
||||
filenames.insert(it);
|
||||
closingStr += it + ", ";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue