Fix bug in actor task dispatch. (#552)

* Fix bug in actor task dispatch.

* Return early from dispatch_actor_task if creation notification has not arrived. Also fix comment.
This commit is contained in:
Robert Nishihara
2017-05-15 23:47:15 -07:00
committed by Stephanie Wang
parent 31bf0e8da4
commit 9018dffd7f
@@ -295,7 +295,11 @@ bool dispatch_actor_task(LocalSchedulerState *state,
/* Make sure this worker actually is an actor. */
CHECK(!ActorID_equal(actor_id, NIL_ACTOR_ID));
/* Make sure this actor belongs to this local scheduler. */
CHECK(state->actor_mapping.count(actor_id) == 1);
if (state->actor_mapping.count(actor_id) != 1) {
/* The creation notification for this actor has not yet arrived at the local
* scheduler. This should be rare. */
return false;
}
CHECK(DBClientID_equal(state->actor_mapping[actor_id].local_scheduler_id,
get_db_client_id(state->db)))
@@ -914,14 +918,14 @@ void handle_actor_task_scheduled(LocalSchedulerState *state,
ActorID actor_id = TaskSpec_actor_id(spec);
DCHECK(!ActorID_equal(actor_id, NIL_ACTOR_ID));
if (state->actor_mapping.count(actor_id) == 1) {
DCHECK(DBClientID_equal(state->actor_mapping[actor_id].local_scheduler_id,
get_db_client_id(state->db)));
} else {
/* This means that an actor has been assigned to this local scheduler, and a
* task for that actor has been received by this local scheduler, but this
* local scheduler has not yet processed the notification about the actor
* creation. This may be possible though should be very uncommon. If it does
* happen, it's ok. */
DCHECK(DBClientID_equal(state->actor_mapping[actor_id].local_scheduler_id,
get_db_client_id(state->db)));
} else {
LOG_INFO(
"handle_actor_task_scheduled called on local scheduler but the "
"corresponding actor_map_entry is not present. This should be rare.");