Recover from stale mutexes with force unlocking and retry
This commit is contained in:
committed by
Patrick Niklaus
parent
caa7c994a0
commit
81c5cba0e5
@@ -150,7 +150,7 @@ class SharedDataFacade final : public BaseDataFacade
|
||||
if (!boost::filesystem::exists(file_index_path))
|
||||
{
|
||||
util::SimpleLogger().Write(logDEBUG) << "Leaf file name " << file_index_path.string();
|
||||
throw util::exception("Could not load leaf index file. "
|
||||
throw util::exception("Could not load " + file_index_path.string() +
|
||||
"Is any data loaded into shared memory?");
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,23 @@ struct SharedBarriers
|
||||
{
|
||||
}
|
||||
|
||||
static void resetCurrentRegions()
|
||||
{
|
||||
boost::interprocess::named_sharable_mutex::remove("current_regions");
|
||||
}
|
||||
static void resetRegions1()
|
||||
{
|
||||
boost::interprocess::named_sharable_mutex::remove("regions_1");
|
||||
}
|
||||
static void resetRegions2()
|
||||
{
|
||||
boost::interprocess::named_sharable_mutex::remove("regions_2");
|
||||
}
|
||||
|
||||
boost::interprocess::named_upgradable_mutex current_regions_mutex;
|
||||
boost::interprocess::named_sharable_mutex regions_1_mutex;
|
||||
boost::interprocess::named_sharable_mutex regions_2_mutex;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,15 @@ class Storage
|
||||
{
|
||||
public:
|
||||
Storage(StorageConfig config);
|
||||
int Run();
|
||||
|
||||
enum ReturnCode
|
||||
{
|
||||
Ok,
|
||||
Error,
|
||||
Retry
|
||||
};
|
||||
|
||||
ReturnCode Run(int max_wait);
|
||||
|
||||
private:
|
||||
StorageConfig config;
|
||||
|
||||
Reference in New Issue
Block a user