Fix logging of migrating actors.

This commit is contained in:
levlam 2024-02-01 16:00:38 +03:00
parent d120d0ab66
commit c287f02e9a
2 changed files with 7 additions and 3 deletions

View File

@ -300,8 +300,7 @@ void Scheduler::do_event(ActorInfo *actor_info, Event &&event) {
} }
void Scheduler::register_migrated_actor(ActorInfo *actor_info) { void Scheduler::register_migrated_actor(ActorInfo *actor_info) {
VLOG(actor) << "Register migrated actor: " << tag("name", *actor_info) << tag("ptr", actor_info) VLOG(actor) << "Register migrated actor " << *actor_info << ", " << tag("actor_count", actor_count_);
<< tag("actor_count", actor_count_);
actor_count_++; actor_count_++;
LOG_CHECK(actor_info->is_migrating()) << *actor_info << ' ' << actor_count_ << ' ' << sched_id_ << ' ' LOG_CHECK(actor_info->is_migrating()) << *actor_info << ' ' << actor_count_ << ' ' << sched_id_ << ' '
<< actor_info->migrate_dest() << ' ' << actor_info->is_running() << ' ' << actor_info->migrate_dest() << ' ' << actor_info->is_running() << ' '
@ -389,6 +388,7 @@ void Scheduler::add_to_mailbox(ActorInfo *actor_info, Event &&event) {
void Scheduler::do_stop_actor(Actor *actor) { void Scheduler::do_stop_actor(Actor *actor) {
return do_stop_actor(actor->get_info()); return do_stop_actor(actor->get_info());
} }
void Scheduler::do_stop_actor(ActorInfo *actor_info) { void Scheduler::do_stop_actor(ActorInfo *actor_info) {
CHECK(!actor_info->is_migrating()); CHECK(!actor_info->is_migrating());
LOG_CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_; LOG_CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_;
@ -410,6 +410,7 @@ void Scheduler::do_stop_actor(ActorInfo *actor_info) {
void Scheduler::migrate_actor(Actor *actor, int32 dest_sched_id) { void Scheduler::migrate_actor(Actor *actor, int32 dest_sched_id) {
migrate_actor(actor->get_info(), dest_sched_id); migrate_actor(actor->get_info(), dest_sched_id);
} }
void Scheduler::migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { void Scheduler::migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) {
CHECK(event_context_ptr_->actor_info == actor_info); CHECK(event_context_ptr_->actor_info == actor_info);
if (sched_id_ == dest_sched_id) { if (sched_id_ == dest_sched_id) {
@ -422,6 +423,7 @@ void Scheduler::migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) {
void Scheduler::do_migrate_actor(Actor *actor, int32 dest_sched_id) { void Scheduler::do_migrate_actor(Actor *actor, int32 dest_sched_id) {
do_migrate_actor(actor->get_info(), dest_sched_id); do_migrate_actor(actor->get_info(), dest_sched_id);
} }
void Scheduler::do_migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { void Scheduler::do_migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) {
#if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED #if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED
dest_sched_id = 0; dest_sched_id = 0;
@ -438,7 +440,7 @@ void Scheduler::start_migrate_actor(Actor *actor, int32 dest_sched_id) {
} }
void Scheduler::start_migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { void Scheduler::start_migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) {
VLOG(actor) << "Start migrate actor: " << tag("name", actor_info) << tag("ptr", actor_info) VLOG(actor) << "Start migrate actor " << *actor_info << " to scheduler " << dest_sched_id << ", "
<< tag("actor_count", actor_count_); << tag("actor_count", actor_count_);
actor_count_--; actor_count_--;
CHECK(actor_count_ >= 0); CHECK(actor_count_ >= 0);

View File

@ -54,6 +54,7 @@ class EventGuard {
inline SchedulerGuard Scheduler::get_guard() { inline SchedulerGuard Scheduler::get_guard() {
return SchedulerGuard(this); return SchedulerGuard(this);
} }
inline SchedulerGuard Scheduler::get_const_guard() { inline SchedulerGuard Scheduler::get_const_guard() {
return SchedulerGuard(this, false); return SchedulerGuard(this, false);
} }
@ -61,6 +62,7 @@ inline SchedulerGuard Scheduler::get_const_guard() {
inline int32 Scheduler::sched_id() const { inline int32 Scheduler::sched_id() const {
return sched_id_; return sched_id_;
} }
inline int32 Scheduler::sched_count() const { inline int32 Scheduler::sched_count() const {
return sched_n_; return sched_n_;
} }