mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
add the last logfile that is less than the zxid.
This commit is contained in:
parent
5a755d1e7c
commit
ba33fbbf1d
@ -572,12 +572,24 @@ void deserializeLogsAndApplyToStorage(KeeperStorage & storage, const std::string
|
|||||||
|
|
||||||
LOG_INFO(log, "Totally have {} logs", existing_logs.size());
|
LOG_INFO(log, "Totally have {} logs", existing_logs.size());
|
||||||
|
|
||||||
for (auto [zxid, log_path] : existing_logs)
|
std::vector<std::string> stored_files;
|
||||||
|
for (auto it = existing_logs.rbegin(); it != existing_logs.rend(); ++it)
|
||||||
{
|
{
|
||||||
if (zxid > storage.zxid)
|
if (it->first >= storage.zxid)
|
||||||
deserializeLogAndApplyToStorage(storage, log_path, log);
|
{
|
||||||
else
|
stored_files.emplace_back(it->second);
|
||||||
LOG_INFO(log, "Skipping log {}, it's ZXID {} is smaller than storages ZXID {}", log_path, zxid, storage.zxid);
|
}
|
||||||
|
else if (it->first < storage.zxid)
|
||||||
|
{
|
||||||
|
/// add the last logfile that is less than the zxid
|
||||||
|
stored_files.emplace_back(it->second);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto & log_path : stored_files)
|
||||||
|
{
|
||||||
|
deserializeLogAndApplyToStorage(storage, log_path, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user