Fix compiling error of reverse iterators
MacOS and Windows compiler doesn't like the use of "!=" operator of std::map::reverse_iterator.
This commit is contained in:
parent
a0fb8ad5fc
commit
a015277e49
|
@ -64,19 +64,18 @@ std::map<std::tuple<LogEpoch, Version, int>, std::map<Tag, Version>> BackupProgr
|
|||
updateTagVersions(&tagVersions, &tags, progressIt->second, info.epochEnd, epoch);
|
||||
} else {
|
||||
auto rit = findPreviousProgress(epoch);
|
||||
if (rit != progress.rend()) {
|
||||
if (!(rit == progress.rend())) {
|
||||
// A partial recovery can result in empty epoch that copies previous
|
||||
// epoch's version range. In this case, we should check previous
|
||||
// epoch's savedVersion.
|
||||
int savedMore = 0;
|
||||
for (auto [tag, version] : rit->second) {
|
||||
if (version > info.epochBegin) {
|
||||
if (version >= info.epochBegin) {
|
||||
savedMore++;
|
||||
}
|
||||
}
|
||||
if (savedMore > 1) {
|
||||
ASSERT(savedMore == rit->second.size()); // all tags should saved more
|
||||
ASSERT(savedMore == info.logRouterTags); // Smae number as logRouterTags
|
||||
if (savedMore > 0) {
|
||||
ASSERT(info.logRouterTags == rit->second.size()); // Same number as logRouterTags
|
||||
|
||||
updateTagVersions(&tagVersions, &tags, rit->second, info.epochEnd, epoch);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
const std::map<Tag, Version>& progress, Version endVersion, LogEpoch epoch);
|
||||
|
||||
std::map<LogEpoch, std::map<Tag, Version>>::reverse_iterator findPreviousProgress(LogEpoch epoch) {
|
||||
for (auto it = progress.rbegin(); it != progress.rend(); ++it) {
|
||||
for (auto it = progress.rbegin(); !(it == progress.rend()); ++it) {
|
||||
if (it->first < epoch) return it;
|
||||
}
|
||||
return progress.rend();
|
||||
|
|
Loading…
Reference in New Issue