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 (it->first >= storage.zxid)
|
||||||
|
{
|
||||||
|
stored_files.emplace_back(it->second);
|
||||||
|
}
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
if (zxid > storage.zxid)
|
|
||||||
deserializeLogAndApplyToStorage(storage, log_path, log);
|
deserializeLogAndApplyToStorage(storage, log_path, log);
|
||||||
else
|
|
||||||
LOG_INFO(log, "Skipping log {}, it's ZXID {} is smaller than storages ZXID {}", log_path, zxid, storage.zxid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user