Skip to content

Commit

Permalink
Better removing chunks from storage, excessive logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ErakhtinB committed Nov 6, 2024
1 parent 373d7bc commit 4b4d16d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions core/parachain/availability/store/store_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,20 @@ namespace kagome::parachain {
if (auto it = state.candidates_.find(relay_parent);
it != state.candidates_.end()) {
for (const auto &l : it->second) {
state.per_candidate_.erase(l);
}
auto space = storage_->getSpace(storage::Space::kAvaliabilityStorage);
if (space) {
for (const auto &candidate_hash : it->second) {
for (const auto &chunk : state.per_candidate_[candidate_hash].chunks) {
space->remove(CandidateChunkKey::encode(candidate_hash, chunk.first));
auto space = storage_->getSpace(storage::Space::kAvaliabilityStorage);
if (space) {
for (const auto &chunk : state.per_candidate_[l].chunks) {
if (not space->remove(CandidateChunkKey::encode(l, chunk.second.index))) {
SL_ERROR(logger, "Failed to remove chunk candidate {} index {}", l, chunk.second.index);
} else {
SL_INFO(logger, "Removed chunk candidate {} index {}", l, chunk.second.index);
}
}
} else {
SL_ERROR(logger, "Failed to get AvaliabilityStorage space in remove");
}
state.per_candidate_.erase(l);
SL_INFO(logger, "Removed candidate from memory {}", l);
}
state.candidates_.erase(it);
}
Expand Down

0 comments on commit 4b4d16d

Please sign in to comment.