Skip to content

Commit d6eb770

Browse files
committed
Fix initializing neighbor stats in collator
1 parent b788322 commit d6eb770

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

validator/impl/collator.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ bool Collator::add_trivial_neighbor_after_merge() {
12451245
nb.set_queue_root(out_msg_queue_->get_root_cell());
12461246
nb.processed_upto = processed_upto_;
12471247
nb.blk_.id.shard = get_shard();
1248+
stats_.neighbors[i].shard = nb.blk_.shard_full();
12481249
LOG(DEBUG) << "adjusted neighbor #" << i << " : " << nb.blk_.to_str()
12491250
<< " with shard expansion (immediate after-merge adjustment)";
12501251
} else {
@@ -1320,10 +1321,13 @@ bool Collator::add_trivial_neighbor() {
13201321
CHECK(sibling_out_msg_queue_);
13211322
CHECK(sibling_processed_upto_);
13221323
neighbors_.emplace_back(*descr_ref);
1324+
stats_.neighbors.push_back(CollationStats::NeighborStats{
1325+
.shard = descr_ref->shard(), .is_trivial = true, .is_local = true, .msg_limit = -1});
13231326
auto& nb2 = neighbors_.at(i);
13241327
nb2.set_queue_root(sibling_out_msg_queue_->get_root_cell());
13251328
nb2.processed_upto = sibling_processed_upto_;
13261329
nb2.blk_.id.shard = ton::shard_sibling(get_shard());
1330+
stats_.neighbors[i].shard = nb2.blk_.shard_full();
13271331
LOG(DEBUG) << "adjusted neighbor #" << i << " : " << nb2.blk_.to_str()
13281332
<< " with shard shrinking to our sibling (immediate after-split adjustment)";
13291333
auto& nb1 = neighbors_.at(n);
@@ -1343,6 +1347,8 @@ bool Collator::add_trivial_neighbor() {
13431347
CHECK(!sibling_out_msg_queue_);
13441348
CHECK(!sibling_processed_upto_);
13451349
neighbors_.emplace_back(*descr_ref);
1350+
stats_.neighbors.push_back(CollationStats::NeighborStats{
1351+
.shard = descr_ref->shard(), .is_trivial = true, .is_local = true, .msg_limit = -1});
13461352
auto& nb2 = neighbors_.at(i);
13471353
auto sib_shard = ton::shard_sibling(shard_);
13481354
// compute the part of virtual sibling's OutMsgQueue with destinations in our shard
@@ -1362,6 +1368,7 @@ bool Collator::add_trivial_neighbor() {
13621368
return fatal_error("error splitting ProcessedUpto for our virtual sibling");
13631369
}
13641370
nb2.blk_.id.shard = ton::shard_sibling(get_shard());
1371+
stats_.neighbors[i].shard = nb2.blk_.shard_full();
13651372
LOG(DEBUG) << "adjusted neighbor #" << i << " : " << nb2.blk_.to_str()
13661373
<< " with shard shrinking to our sibling (continued after-split adjustment)";
13671374
auto& nb1 = neighbors_.at(n);
@@ -6410,6 +6417,14 @@ void Collator::finalize_stats() {
64106417
});
64116418
}
64126419
stats_.new_out_msg_queue_size = out_msg_queue_size_;
6420+
6421+
auto neighbors_stats = std::move(stats_.neighbors);
6422+
stats_.neighbors.clear();
6423+
for (size_t i = 0; i < neighbors_stats.size(); ++i) {
6424+
if (!neighbors_.at(i).is_disabled()) {
6425+
stats_.neighbors.push_back(std::move(neighbors_stats[i]));
6426+
}
6427+
}
64136428
}
64146429

64156430
/**

0 commit comments

Comments
 (0)