Trying to debug keeper logs disappearance

This commit is contained in:
alesapin 2021-08-30 16:07:58 +03:00
parent af709ab9a0
commit 00935c3bb3
2 changed files with 6 additions and 1 deletions

View File

@ -513,11 +513,15 @@ void Changelog::writeAt(uint64_t index, const LogEntryPtr & log_entry)
void Changelog::compact(uint64_t up_to_log_index)
{
LOG_INFO(log, "Compact logs up to log index {}", up_to_log_index);
for (auto itr = existing_changelogs.begin(); itr != existing_changelogs.end();)
{
/// Remove all completely outdated changelog files
if (itr->second.to_log_index <= up_to_log_index)
{
if (current_writer && itr->second.from_log_index == current_writer->getStartIndex())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Trying to remove log {} which is current active log for write. It's a bug.", itr->second.path);
LOG_INFO(log, "Removing changelog {} because of compaction", itr->second.path);
std::erase_if(index_to_start_pos, [right_index = itr->second.to_log_index] (const auto & item) { return item.first <= right_index; });
std::filesystem::remove(itr->second.path);

View File

@ -9,7 +9,8 @@
<force_sync>false</force_sync>
<startup_timeout>60000</startup_timeout>
<!-- we want all logs for complex problems investigation -->
<reserved_log_items>1000000000000000</reserved_log_items>
<reserved_log_items>10000</reserved_log_items>
<rotate_log_interval>33333</rotate_log_interval>
</coordination_settings>
<raft_configuration>