**Describe the bug**
https://github.com/ClickHouse/ClickHouse/pull/18899#issuecomment-757571194

index_granularity.popMark();
        index_granularity.appendMark(new_rows_in_last_mark);
    }
    
    if (last_non_written_marks.empty())
        throw Exception(ErrorCodes::LOGICAL_ERROR, "No saved marks for last mark {} having rows offset {}, total marks {}",
                        getCurrentMark(), rows_written_in_last_mark, index_granularity.getMarksCount());
    if (rows_written_in_last_mark == new_rows_in_last_mark)
    {
        for (const auto & [name, marks] : last_non_written_marks)
        {
            for (const auto & mark : marks)
                flushMarkToFile(mark, index_granularity.getMarkRows(getCurrentMark()));
        }
        last_non_written_marks.clear();
        if (compute_granularity && settings.can_use_adaptive_granularity)
        {
            
            
            for (size_t i = 0; i < skip_indices.size(); ++i)
                ++skip_index_accumulated_marks[i];
            
            setCurrentMark(getCurrentMark() + 1);
            
            rows_written_in_last_mark = 0;
        }
    }
}
}