Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/network/impl/peer_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ namespace kagome::network {
return remote_view_.sharedAccess([](const auto &rv) { return rv.size(); });
}

void PeerView::printStoragesLoad() const {
const size_t remote_veiw_size =
remote_view_.sharedAccess([](const auto &rv) { return rv.size(); });

SL_TRACE(logger,
"[Peer View storages statistics]:"
"\n\t-> remote_view={}",
remote_veiw_size);
Comment on lines +116 to +119
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use single-line messages, at least over several messages? Messages with line-breaks can spoil log or break works some log-readers

}

void PeerView::removePeer(const PeerId &peer_id) {
auto ref = remote_view_.exclusiveAccess(
[&](auto &rv) -> std::optional<network::View> {
Expand Down
5 changes: 5 additions & 0 deletions core/network/peer_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "blockchain/block_tree.hpp"
#include "crypto/type_hasher.hpp"
#include "injector/lazy.hpp"
#include "log/logger.hpp"
#include "network/types/collator_messages.hpp"
#include "outcome/outcome.hpp"
#include "primitives/event_types.hpp"
Expand Down Expand Up @@ -88,6 +89,8 @@ namespace kagome::network {
return my_view_stripped_;
}

void printStoragesLoad() const;

private:
void updateMyView(const primitives::BlockHeader &header);

Expand All @@ -100,6 +103,8 @@ namespace kagome::network {
View my_view_;
View my_view_stripped_;
SafeObject<std::unordered_map<PeerId, View>> remote_view_;

log::Logger logger = log::createLogger("PeerView", "parachain");
};

} // namespace kagome::network
2 changes: 1 addition & 1 deletion core/parachain/validator/backing_implicit_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace kagome::parachain {
/// Trace print of all internal buffers.
///
/// Usable for tracing memory consumption.
void printStoragesLoad() {
void printStoragesLoad() const {
SL_TRACE(logger,
"[Backing implicit view statistics]:"
"\n\t-> leaves={}"
Expand Down
24 changes: 9 additions & 15 deletions core/parachain/validator/impl/parachain_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,7 @@ namespace kagome::parachain {
}

void ParachainProcessorImpl::onDeactivateBlocks(
const primitives::events::RemoveAfterFinalizationParams &event) {
REINVOKE(*main_pool_handler_, onDeactivateBlocks, event);

for (const auto &lost : event.removed) {
SL_TRACE(logger_,
"Remove from storages.(relay parent={}, number={})",
lost.hash,
lost.number);

backing_store_->onDeactivateLeaf(lost.hash);
bitfield_store_->remove(lost.hash);
}
}
const primitives::events::RemoveAfterFinalizationParams &event) {}

outcome::result<std::optional<ValidatorSigner>>
ParachainProcessorImpl::isParachainValidator(
Expand Down Expand Up @@ -667,6 +655,8 @@ namespace kagome::parachain {
for (const auto &l : lost) {
our_current_state_.per_leaf.erase(l);
pruned = our_current_state_.implicit_view->deactivate_leaf(l);
backing_store_->onDeactivateLeaf(l);
bitfield_store_->remove(l);
}

std::vector<
Expand Down Expand Up @@ -2970,20 +2960,24 @@ namespace kagome::parachain {
"\n\t-> per_candidate={}"
"\n\t-> active_leaves={}"
"\n\t-> collation_requests_cancel_handles={}"
"\n\t-> validator_side.fetched_candidates={}",
"\n\t-> validator_side.fetched_candidates={}"
"\n\t-> validator_side.blocked_from_seconding={}",
our_current_state_.state_by_relay_parent.size(),
our_current_state_.per_leaf.size(),
our_current_state_.per_candidate.size(),
our_current_state_.validator_side.active_leaves.size(),
our_current_state_.collation_requests_cancel_handles.size(),
our_current_state_.validator_side.fetched_candidates.size());
our_current_state_.validator_side.fetched_candidates.size(),
our_current_state_.validator_side.blocked_from_seconding.size());

if (our_current_state_.implicit_view) {
our_current_state_.implicit_view->printStoragesLoad();
}
prospective_parachains_->printStoragesLoad();
bitfield_store_->printStoragesLoad();
backing_store_->printStoragesLoad();
av_store_->printStoragesLoad();
statement_distribution->printStoragesLoad();
}

void ParachainProcessorImpl::handle_advertisement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace kagome::parachain {
"\n\t-> view.active_leaves={}",
view().per_relay_parent.size(),
view().active_leaves.size());
view().implicit_view.printStoragesLoad();
}

std::shared_ptr<blockchain::BlockTree> ProspectiveParachains::getBlockTree() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,22 @@ namespace kagome::parachain::statement_distribution {
router->getValidationProtocol()->write(statement_to_peers, message_v2);
}

void StatementDistribution::printStoragesLoad() {
SL_TRACE(logger,
"[Statement Distribution storages statistics]:"
"\n\t-> candidates.candidates={}"
"\n\t-> candidates.by_parent={}"
"\n\t-> per_relay_parent={}"
"\n\t-> peers={}",
candidates.candidates.size(),
candidates.by_parent.size(),
per_relay_parent.size(),
peers.size());

implicit_view.sharedAccess([](const auto &iv) { iv.printStoragesLoad(); });
peer_view->printStoragesLoad();
}

void StatementDistribution::share_local_statement(
const primitives::BlockHash &relay_parent,
const SignedFullStatementWithPVD &statement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ namespace kagome::parachain::statement_distribution {
void share_local_statement(const primitives::BlockHash &relay_parent,
const SignedFullStatementWithPVD &statement);

void printStoragesLoad();

private:
struct ManifestImportSuccess {
bool acknowledge;
Expand Down
Loading