Switching char* to std::string for ProcessInfo to have it own memory (valgrind errors) (#7176)
This commit is contained in:
parent
840786ced5
commit
a43c98519d
|
@ -106,14 +106,14 @@ void ISimulator::displayWorkers() const {
|
|||
for (auto& processInfo : machineRecord.second) {
|
||||
printf(" %9s %-10s%-13s%-8s %-6s %-9s %-8s %-48s %-40s\n",
|
||||
processInfo->address.toString().c_str(),
|
||||
processInfo->name,
|
||||
processInfo->name.c_str(),
|
||||
processInfo->startingClass.toString().c_str(),
|
||||
(processInfo->isExcluded() ? "True" : "False"),
|
||||
(processInfo->failed ? "True" : "False"),
|
||||
(processInfo->rebooting ? "True" : "False"),
|
||||
(processInfo->isCleared() ? "True" : "False"),
|
||||
getRoles(processInfo->address).c_str(),
|
||||
processInfo->dataFolder);
|
||||
processInfo->dataFolder.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1588,7 +1588,7 @@ public:
|
|||
.detail("Protected", protectedAddresses.count(machine->address))
|
||||
.backtrace();
|
||||
// This will remove all the "tracked" messages that came from the machine being killed
|
||||
if (std::string(machine->name) != "remote flow process")
|
||||
if (machine->name != "remote flow process")
|
||||
latestEventCache.clear();
|
||||
machine->failed = true;
|
||||
} else if (kt == InjectFaults) {
|
||||
|
@ -1618,7 +1618,7 @@ public:
|
|||
ASSERT(false);
|
||||
}
|
||||
ASSERT(!protectedAddresses.count(machine->address) || machine->rebooting ||
|
||||
std::string(machine->name) == "remote flow process");
|
||||
machine->name == "remote flow process");
|
||||
}
|
||||
void rebootProcess(ProcessInfo* process, KillType kt) override {
|
||||
if (kt == RebootProcessAndDelete && protectedAddresses.count(process->address)) {
|
||||
|
@ -2465,7 +2465,7 @@ ACTOR void doReboot(ISimulator::ProcessInfo* p, ISimulator::KillType kt) {
|
|||
.detail("Rebooting", p->rebooting)
|
||||
.detail("Reliable", p->isReliable());
|
||||
return;
|
||||
} else if (std::string(p->name) == "remote flow process") {
|
||||
} else if (p->name == "remote flow process") {
|
||||
TraceEvent(SevDebug, "DoRebootFailed").detail("Name", p->name).detail("Address", p->address);
|
||||
return;
|
||||
} else if (p->getChilds().size()) {
|
||||
|
|
|
@ -59,9 +59,9 @@ public:
|
|||
struct MachineInfo;
|
||||
|
||||
struct ProcessInfo : NonCopyable {
|
||||
const char* name;
|
||||
const char* coordinationFolder;
|
||||
const char* dataFolder;
|
||||
std::string name;
|
||||
std::string coordinationFolder;
|
||||
std::string dataFolder;
|
||||
MachineInfo* machine;
|
||||
NetworkAddressList addresses;
|
||||
NetworkAddress address;
|
||||
|
@ -182,7 +182,7 @@ public:
|
|||
std::string toString() const {
|
||||
return format(
|
||||
"name: %s address: %s zone: %s datahall: %s class: %s excluded: %d cleared: %d",
|
||||
name,
|
||||
name.c_str(),
|
||||
formatIpPort(addresses.address.ip, addresses.address.port).c_str(),
|
||||
(locality.zoneId().present() ? locality.zoneId().get().printable().c_str() : "[unset]"),
|
||||
(locality.dataHallId().present() ? locality.dataHallId().get().printable().c_str() : "[unset]"),
|
||||
|
|
|
@ -160,16 +160,17 @@ ACTOR Future<int> spawnSimulated(std::vector<std::string> paramList,
|
|||
}
|
||||
}
|
||||
state int result = 0;
|
||||
child = g_pSimulator->newProcess("remote flow process",
|
||||
self->address.ip,
|
||||
0,
|
||||
self->address.isTLS(),
|
||||
self->addresses.secondaryAddress.present() ? 2 : 1,
|
||||
self->locality,
|
||||
ProcessClass(ProcessClass::UnsetClass, ProcessClass::AutoSource),
|
||||
self->dataFolder,
|
||||
self->coordinationFolder, // do we need to customize this coordination folder path?
|
||||
self->protocolVersion);
|
||||
child = g_pSimulator->newProcess(
|
||||
"remote flow process",
|
||||
self->address.ip,
|
||||
0,
|
||||
self->address.isTLS(),
|
||||
self->addresses.secondaryAddress.present() ? 2 : 1,
|
||||
self->locality,
|
||||
ProcessClass(ProcessClass::UnsetClass, ProcessClass::AutoSource),
|
||||
self->dataFolder.c_str(),
|
||||
self->coordinationFolder.c_str(), // do we need to customize this coordination folder path?
|
||||
self->protocolVersion);
|
||||
wait(g_pSimulator->onProcess(child));
|
||||
state Future<ISimulator::KillType> onShutdown = child->onShutdown();
|
||||
state Future<ISimulator::KillType> parentShutdown = self->onShutdown();
|
||||
|
|
|
@ -494,7 +494,7 @@ void printSimulatedTopology() {
|
|||
printf("%sAddress: %s\n", indent.c_str(), p->address.toString().c_str());
|
||||
indent += " ";
|
||||
printf("%sClass: %s\n", indent.c_str(), p->startingClass.toString().c_str());
|
||||
printf("%sName: %s\n", indent.c_str(), p->name);
|
||||
printf("%sName: %s\n", indent.c_str(), p->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class WorkloadProcessState {
|
|||
locality,
|
||||
ProcessClass(ProcessClass::TesterClass, ProcessClass::AutoSource),
|
||||
dataFolder.c_str(),
|
||||
parent->coordinationFolder,
|
||||
parent->coordinationFolder.c_str(),
|
||||
parent->protocolVersion);
|
||||
self->childProcess->excludeFromRestarts = true;
|
||||
wait(g_simulator.onProcess(self->childProcess, TaskPriority::DefaultYield));
|
||||
|
|
|
@ -72,13 +72,13 @@ struct SaveAndKillWorkload : TestWorkload {
|
|||
std::map<std::string, ISimulator::ProcessInfo*> allProcessesMap;
|
||||
for (const auto& [_, process] : rebootingProcesses) {
|
||||
if (allProcessesMap.find(process->dataFolder) == allProcessesMap.end() &&
|
||||
std::string(process->name) != "remote flow process") {
|
||||
process->name != "remote flow process") {
|
||||
allProcessesMap[process->dataFolder] = process;
|
||||
}
|
||||
}
|
||||
for (const auto& process : processes) {
|
||||
if (allProcessesMap.find(process->dataFolder) == allProcessesMap.end() &&
|
||||
std::string(process->name) != "remote flow process") {
|
||||
process->name != "remote flow process") {
|
||||
allProcessesMap[process->dataFolder] = process;
|
||||
}
|
||||
}
|
||||
|
@ -106,18 +106,22 @@ struct SaveAndKillWorkload : TestWorkload {
|
|||
ini.SetValue(machineIdString,
|
||||
format("ipAddr%d", process->address.port - 1).c_str(),
|
||||
process->address.ip.toString().c_str());
|
||||
ini.SetValue(machineIdString, format("%d", process->address.port - 1).c_str(), process->dataFolder);
|
||||
ini.SetValue(
|
||||
machineIdString, format("c%d", process->address.port - 1).c_str(), process->coordinationFolder);
|
||||
machineIdString, format("%d", process->address.port - 1).c_str(), process->dataFolder.c_str());
|
||||
ini.SetValue(machineIdString,
|
||||
format("c%d", process->address.port - 1).c_str(),
|
||||
process->coordinationFolder.c_str());
|
||||
j++;
|
||||
} else {
|
||||
ini.SetValue(machineIdString,
|
||||
format("ipAddr%d", process->address.port - 1).c_str(),
|
||||
process->address.ip.toString().c_str());
|
||||
int oldValue = machines.find(machineId)->second;
|
||||
ini.SetValue(machineIdString, format("%d", process->address.port - 1).c_str(), process->dataFolder);
|
||||
ini.SetValue(
|
||||
machineIdString, format("c%d", process->address.port - 1).c_str(), process->coordinationFolder);
|
||||
machineIdString, format("%d", process->address.port - 1).c_str(), process->dataFolder.c_str());
|
||||
ini.SetValue(machineIdString,
|
||||
format("c%d", process->address.port - 1).c_str(),
|
||||
process->coordinationFolder.c_str());
|
||||
machines.erase(machines.find(machineId));
|
||||
machines.insert(std::pair<std::string, int>(machineId, oldValue + 1));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue