Fix race in multiple DB mirroring configurations.

This commit is contained in:
Adam Ierymenko 2019-08-08 15:29:13 -05:00
parent ad2a7c2590
commit 28d0070ce2
No known key found for this signature in database
GPG key ID: 1657198823E52A61
5 changed files with 30 additions and 20 deletions

View file

@ -114,6 +114,28 @@ public:
}
protected:
inline bool _compareRecords(const nlohmann::json &a,const nlohmann::json &b)
{
if (a.is_object() == b.is_object()) {
if (a.is_object()) {
if (a.size() != b.size())
return false;
auto amap = a.get<nlohmann::json::object_t>();
auto bmap = b.get<nlohmann::json::object_t>();
for(auto ai=amap.begin();ai!=amap.end();++ai) {
if (ai->first != "revision") { // ignore revision, compare only non-revision-counter fields
auto bi = bmap.find(ai->first);
if ((bi == bmap.end())||(bi->second != ai->second))
return false;
}
}
return true;
}
return (a == b);
}
return false;
}
struct _Network
{
_Network() : mostRecentDeauthTime(0) {}