Skip to content

Commit 66ddb32

Browse files
committed
Add more logs for BlockArchiver and similar things
1 parent 0667560 commit 66ddb32

File tree

6 files changed

+29
-10
lines changed

6 files changed

+29
-10
lines changed

validator/apply-block.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void ApplyBlock::abort_query(td::Status reason) {
3636
}
3737

3838
void ApplyBlock::finish_query() {
39-
VLOG(VALIDATOR_DEBUG) << "successfully finishing apply block query";
39+
VLOG(VALIDATOR_DEBUG) << "successfully finishing apply block query in " << perf_timer_.elapsed() << " s";
4040
handle_->set_processed();
4141
ValidatorInvariants::check_post_apply(handle_);
4242

validator/db/archiver.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ BlockArchiver::BlockArchiver(BlockHandle handle, td::actor::ActorId<ArchiveManag
3030
}
3131

3232
void BlockArchiver::start_up() {
33+
VLOG(VALIDATOR_DEBUG) << "started block archiver for " << handle_->id().to_str();
3334
if (handle_->id().is_masterchain()) {
3435
td::actor::send_closure(db_, &Db::get_block_state, handle_,
3536
[SelfId = actor_id(this), archive = archive_](td::Result<td::Ref<ShardState>> R) {
@@ -46,6 +47,7 @@ void BlockArchiver::start_up() {
4647
}
4748

4849
void BlockArchiver::move_handle() {
50+
VLOG(VALIDATOR_DEBUG) << "move_handle";
4951
if (handle_->handle_moved_to_archive()) {
5052
moved_handle();
5153
} else {
@@ -58,6 +60,7 @@ void BlockArchiver::move_handle() {
5860
}
5961

6062
void BlockArchiver::moved_handle() {
63+
VLOG(VALIDATOR_DEBUG) << "moved_handle";
6164
CHECK(handle_->handle_moved_to_archive());
6265
if (handle_->moved_to_archive()) {
6366
finish_query();
@@ -78,6 +81,7 @@ void BlockArchiver::moved_handle() {
7881
}
7982

8083
void BlockArchiver::got_proof(td::BufferSlice data) {
84+
VLOG(VALIDATOR_DEBUG) << "got_proof";
8185
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Unit> R) {
8286
R.ensure();
8387
td::actor::send_closure(SelfId, &BlockArchiver::written_proof);
@@ -87,6 +91,7 @@ void BlockArchiver::got_proof(td::BufferSlice data) {
8791
}
8892

8993
void BlockArchiver::written_proof() {
94+
VLOG(VALIDATOR_DEBUG) << "written_proof";
9095
if (!handle_->inited_proof_link()) {
9196
written_proof_link();
9297
return;
@@ -102,6 +107,7 @@ void BlockArchiver::written_proof() {
102107
}
103108

104109
void BlockArchiver::got_proof_link(td::BufferSlice data) {
110+
VLOG(VALIDATOR_DEBUG) << "got_proof_link";
105111
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Unit> R) {
106112
R.ensure();
107113
td::actor::send_closure(SelfId, &BlockArchiver::written_proof_link);
@@ -111,6 +117,7 @@ void BlockArchiver::got_proof_link(td::BufferSlice data) {
111117
}
112118

113119
void BlockArchiver::written_proof_link() {
120+
VLOG(VALIDATOR_DEBUG) << "written_proof_link";
114121
if (!handle_->received()) {
115122
written_block_data();
116123
return;
@@ -124,6 +131,7 @@ void BlockArchiver::written_proof_link() {
124131
}
125132

126133
void BlockArchiver::got_block_data(td::BufferSlice data) {
134+
VLOG(VALIDATOR_DEBUG) << "got_block_data";
127135
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Unit> R) {
128136
R.ensure();
129137
td::actor::send_closure(SelfId, &BlockArchiver::written_block_data);
@@ -133,6 +141,7 @@ void BlockArchiver::got_block_data(td::BufferSlice data) {
133141
}
134142

135143
void BlockArchiver::written_block_data() {
144+
VLOG(VALIDATOR_DEBUG) << "written_block_data";
136145
handle_->set_moved_to_archive();
137146

138147
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this)](td::Result<td::Unit> R) {
@@ -143,15 +152,16 @@ void BlockArchiver::written_block_data() {
143152
}
144153

145154
void BlockArchiver::finish_query() {
155+
VLOG(VALIDATOR_DEBUG) << "finished archiving block in " << timer_.elapsed() << " s";
146156
if (promise_) {
147157
promise_.set_value(td::Unit());
148158
}
149159
stop();
150160
}
151161

152162
void BlockArchiver::abort_query(td::Status reason) {
163+
VLOG(VALIDATOR_WARNING) << "failed to archive block " << handle_->id() << ": " << reason;
153164
if (promise_) {
154-
VLOG(VALIDATOR_WARNING) << "failed to archive block " << handle_->id() << ": " << reason;
155165
promise_.set_error(std::move(reason));
156166
}
157167
stop();

validator/db/archiver.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class BlockArchiver : public td::actor::Actor {
5454
td::actor::ActorId<ArchiveManager> archive_;
5555
td::actor::ActorId<Db> db_;
5656
td::Promise<td::Unit> promise_;
57+
td::Timer timer_;
5758
};
5859

5960
} // namespace validator

validator/db/rootdb.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ void RootDb::try_get_static_file(FileHash file_hash, td::Promise<td::BufferSlice
389389
}
390390

391391
void RootDb::apply_block(BlockHandle handle, td::Promise<td::Unit> promise) {
392-
td::actor::create_actor<BlockArchiver>("archiver", std::move(handle), archive_db_.get(), actor_id(this),
393-
std::move(promise))
392+
td::actor::create_actor<BlockArchiver>(PSTRING() << "archiver" << handle->id().id.to_str(), std::move(handle),
393+
archive_db_.get(), actor_id(this), std::move(promise))
394394
.release();
395395
}
396396

@@ -464,8 +464,8 @@ void RootDb::start_up() {
464464
}
465465

466466
void RootDb::archive(BlockHandle handle, td::Promise<td::Unit> promise) {
467-
td::actor::create_actor<BlockArchiver>("archiveblock", std::move(handle), archive_db_.get(), actor_id(this),
468-
std::move(promise))
467+
td::actor::create_actor<BlockArchiver>(PSTRING() << "archiver" << handle->id().id.to_str(), std::move(handle),
468+
archive_db_.get(), actor_id(this), std::move(promise))
469469
.release();
470470
}
471471

validator/manager.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ void ValidatorManagerImpl::new_block_cont(BlockHandle handle, td::Ref<ShardState
15951595
td::Promise<td::Unit> promise) {
15961596
if (state->get_shard().is_masterchain() && handle->id().id.seqno > last_masterchain_seqno_) {
15971597
if (handle->id().id.seqno == last_masterchain_seqno_ + 1) {
1598+
VLOG(VALIDATOR_DEBUG) << "new block " << handle->id().id.to_str() << " is the next masterchain block";
15981599
last_masterchain_seqno_ = handle->id().id.seqno;
15991600
last_masterchain_state_ = td::Ref<MasterchainState>{state};
16001601
last_masterchain_block_id_ = handle->id();
@@ -1614,6 +1615,7 @@ void ValidatorManagerImpl::new_block_cont(BlockHandle handle, td::Ref<ShardState
16141615
last_masterchain_block_id_ = last_masterchain_block_handle_->id();
16151616
last_masterchain_seqno_ = last_masterchain_block_id_.id.seqno;
16161617
CHECK(it->first == last_masterchain_seqno_);
1618+
VLOG(VALIDATOR_DEBUG) << "processing pending masterchain block " << last_masterchain_block_id_.id.to_str();
16171619

16181620
auto l_promise = std::move(std::get<2>(it->second));
16191621
last_masterchain_block_handle_->set_processed();
@@ -1630,6 +1632,7 @@ void ValidatorManagerImpl::new_block_cont(BlockHandle handle, td::Ref<ShardState
16301632
}
16311633
}
16321634
} else {
1635+
VLOG(VALIDATOR_DEBUG) << "new block " << handle->id().id.to_str() << " is too new masterchain block";
16331636
auto it = pending_masterchain_states_.find(handle->id().id.seqno);
16341637
if (it != pending_masterchain_states_.end()) {
16351638
std::get<2>(it->second).emplace_back(std::move(promise));
@@ -1642,12 +1645,14 @@ void ValidatorManagerImpl::new_block_cont(BlockHandle handle, td::Ref<ShardState
16421645
}
16431646
}
16441647
} else {
1648+
VLOG(VALIDATOR_DEBUG) << "new block " << handle->id().id.to_str() << " is already processed";
16451649
handle->set_processed();
16461650
promise.set_value(td::Unit());
16471651
}
16481652
}
16491653

16501654
void ValidatorManagerImpl::new_block(BlockHandle handle, td::Ref<ShardState> state, td::Promise<td::Unit> promise) {
1655+
VLOG(VALIDATOR_DEBUG) << "new block " << handle->id().id.to_str();
16511656
if (handle->is_applied()) {
16521657
return new_block_cont(std::move(handle), std::move(state), std::move(promise));
16531658
} else {
@@ -2296,7 +2301,9 @@ void ValidatorManagerImpl::new_masterchain_block() {
22962301
td::actor::send_closure(actor, &ShardBlockRetainer::update_masterchain_state, last_masterchain_state_);
22972302
}
22982303
if (last_masterchain_seqno_ % 1024 == 0) {
2299-
LOG(WARNING) << "applied masterchain block " << last_masterchain_block_id_;
2304+
LOG(WARNING) << "applied masterchain block " << last_masterchain_block_id_.to_str();
2305+
} else {
2306+
LOG(DEBUG) << "applied masterchain block " << last_masterchain_block_id_.to_str();
23002307
}
23012308
}
23022309

validator/validate-broadcast.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ void ValidateBroadcast::abort_query(td::Status reason) {
3737

3838
void ValidateBroadcast::finish_query() {
3939
if (promise_) {
40-
VLOG(VALIDATOR_DEBUG) << "validated broadcast for " << broadcast_.block_id.to_str();
40+
VLOG(VALIDATOR_DEBUG) << "validated broadcast for " << broadcast_.block_id.to_str() << " in "
41+
<< perf_timer_.elapsed() << " s";
4142
promise_.set_result(td::Unit());
4243
}
4344
stop();
@@ -321,8 +322,8 @@ void ValidateBroadcast::checked_proof() {
321322
});
322323

323324
VLOG(VALIDATOR_DEBUG) << "apply block";
324-
td::actor::create_actor<ApplyBlock>("applyblock", handle_->id(), data_, handle_->id(), manager_, timeout_,
325-
std::move(P))
325+
td::actor::create_actor<ApplyBlock>(PSTRING() << "apply" << handle_->id().id.to_str(), handle_->id(), data_,
326+
handle_->id(), manager_, timeout_, std::move(P))
326327
.release();
327328
} else {
328329
finish_query();

0 commit comments

Comments
 (0)