1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Make block overloaded if dispatch queue processing limit is reached (#1070)

This commit is contained in:
SpyCheese 2024-07-23 16:47:28 +03:00 committed by GitHub
parent 58ca7b44ff
commit 1b9372804f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 10 deletions

View file

@ -214,6 +214,7 @@ class Collator final : public td::actor::Actor {
unsigned dispatch_queue_ops_{0};
std::map<StdSmcAddress, LogicalTime> last_dispatch_queue_emitted_lt_;
bool have_unprocessed_account_dispatch_queue_ = false;
bool dispatch_queue_total_limit_reached_ = false;
td::uint64 defer_out_queue_size_limit_;
td::uint64 hard_defer_out_queue_size_limit_;

View file

@ -3714,6 +3714,7 @@ bool Collator::process_dispatch_queue() {
}
++total_count;
if (total_count >= max_total_count[iter]) {
dispatch_queue_total_limit_reached_ = true;
break;
}
}
@ -4660,7 +4661,21 @@ bool Collator::check_block_overload() {
<< " lt_delta=" << block_limit_status_->cur_lt - block_limit_status_->limits.start_lt
<< " size_estimate=" << block_size_estimate_;
auto cl = block_limit_status_->classify();
if (cl <= block::ParamLimits::cl_underload) {
if (cl >= block::ParamLimits::cl_soft || dispatch_queue_total_limit_reached_) {
std::string message = "block is overloaded ";
if (cl >= block::ParamLimits::cl_soft) {
message += PSTRING() << "(category " << cl << ")";
} else {
message += "(long dispatch queue processing)";
}
if (out_msg_queue_size_ > SPLIT_MAX_QUEUE_SIZE) {
LOG(INFO) << message << ", but don't set overload history because out_msg_queue size is too big to split ("
<< out_msg_queue_size_ << " > " << SPLIT_MAX_QUEUE_SIZE << ")";
} else {
overload_history_ |= 1;
LOG(INFO) << message;
}
} else if (cl <= block::ParamLimits::cl_underload) {
if (out_msg_queue_size_ > MERGE_MAX_QUEUE_SIZE) {
LOG(INFO)
<< "block is underloaded, but don't set underload history because out_msg_queue size is too big to merge ("
@ -4669,15 +4684,6 @@ bool Collator::check_block_overload() {
underload_history_ |= 1;
LOG(INFO) << "block is underloaded";
}
} else if (cl >= block::ParamLimits::cl_soft) {
if (out_msg_queue_size_ > SPLIT_MAX_QUEUE_SIZE) {
LOG(INFO) << "block is overloaded (category " << cl
<< "), but don't set overload history because out_msg_queue size is too big to split ("
<< out_msg_queue_size_ << " > " << SPLIT_MAX_QUEUE_SIZE << ")";
} else {
overload_history_ |= 1;
LOG(INFO) << "block is overloaded (category " << cl << ")";
}
} else {
LOG(INFO) << "block is loaded normally";
}