MCPcopy Create free account
hub / github.com/apache/impala / UpdateState

Method UpdateState

be/src/runtime/fragment-instance-state.cc:580–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580void FragmentInstanceState::UpdateState(const StateEvent event)
581{
582 FInstanceExecStatePB current_state = current_state_.Load();
583 FInstanceExecStatePB next_state = current_state;
584 switch (event) {
585 case StateEvent::PREPARE_START:
586 DCHECK_EQ(current_state, FInstanceExecStatePB::WAITING_FOR_EXEC);
587 next_state = FInstanceExecStatePB::WAITING_FOR_PREPARE;
588 break;
589
590 case StateEvent::CODEGEN_START:
591 DCHECK_EQ(current_state, FInstanceExecStatePB::WAITING_FOR_PREPARE);
592 event_sequence_->MarkEvent("Prepare Finished");
593 next_state = FInstanceExecStatePB::WAITING_FOR_CODEGEN;
594 break;
595
596 case StateEvent::OPEN_START:
597 if (current_state == FInstanceExecStatePB::WAITING_FOR_PREPARE) {
598 event_sequence_->MarkEvent("Prepare Finished");
599 } else {
600 DCHECK_EQ(current_state, FInstanceExecStatePB::WAITING_FOR_CODEGEN);
601 }
602 next_state = FInstanceExecStatePB::WAITING_FOR_OPEN;
603 break;
604
605 case StateEvent::WAITING_FOR_FIRST_BATCH:
606 DCHECK_EQ(current_state, FInstanceExecStatePB::WAITING_FOR_OPEN);
607 event_sequence_->MarkEvent("Open Finished");
608 next_state = FInstanceExecStatePB::WAITING_FOR_FIRST_BATCH;
609 break;
610
611 case StateEvent::BATCH_PRODUCED:
612 if (UNLIKELY(current_state == FInstanceExecStatePB::WAITING_FOR_FIRST_BATCH)) {
613 event_sequence_->MarkEvent("First Batch Produced");
614 next_state = FInstanceExecStatePB::FIRST_BATCH_PRODUCED;
615 } else {
616 DCHECK_EQ(current_state, FInstanceExecStatePB::PRODUCING_DATA);
617 }
618 break;
619
620 case StateEvent::BATCH_SENT:
621 if (UNLIKELY(current_state == FInstanceExecStatePB::FIRST_BATCH_PRODUCED)) {
622 event_sequence_->MarkEvent("First Batch Sent");
623 next_state = FInstanceExecStatePB::PRODUCING_DATA;
624 } else {
625 DCHECK_EQ(current_state, FInstanceExecStatePB::PRODUCING_DATA);
626 }
627 break;
628
629 case StateEvent::LAST_BATCH_SENT:
630 DCHECK_EQ(current_state, FInstanceExecStatePB::PRODUCING_DATA);
631 next_state = FInstanceExecStatePB::LAST_BATCH_SENT;
632 break;
633
634 case StateEvent::EXEC_END:
635 // Allow abort in all states to make error handling easier.
636 event_sequence_->MarkEvent("ExecInternal Finished");
637 next_state = FInstanceExecStatePB::FINISHED;

Callers

nothing calls this directly

Calls 3

MarkEventMethod · 0.80
LoadMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected