| 446 | } |
| 447 | |
| 448 | Status ExecNode::ExecDebugActionImpl(TExecNodePhase::type phase, RuntimeState* state) { |
| 449 | DCHECK_EQ(debug_options_.phase, phase); |
| 450 | if (debug_options_.action == TDebugAction::FAIL) { |
| 451 | return Status(TErrorCode::INTERNAL_ERROR, "Debug Action: FAIL"); |
| 452 | } else if (debug_options_.action == TDebugAction::WAIT) { |
| 453 | // See DebugOptions::DebugOptions(). |
| 454 | DCHECK(phase != TExecNodePhase::PREPARE && phase != TExecNodePhase::CLOSE); |
| 455 | while (!state->is_cancelled()) { |
| 456 | sleep(1); |
| 457 | } |
| 458 | return Status::CANCELLED; |
| 459 | } else if (debug_options_.action == TDebugAction::INJECT_ERROR_LOG) { |
| 460 | state->LogError( |
| 461 | ErrorMsg(TErrorCode::INTERNAL_ERROR, "Debug Action: INJECT_ERROR_LOG")); |
| 462 | return Status::OK(); |
| 463 | } else if (debug_options_.action == TDebugAction::MEM_LIMIT_EXCEEDED) { |
| 464 | return MemTracker::MemLimitExceeded( |
| 465 | mem_tracker(), state, "Debug Action: MEM_LIMIT_EXCEEDED"); |
| 466 | } else if (debug_options_.action == TDebugAction::SET_DENY_RESERVATION_PROBABILITY) { |
| 467 | // We can only enable the debug action if the buffer pool client is registered. |
| 468 | // If the buffer client is not registered at this point (e.g. if phase is PREPARE or |
| 469 | // OPEN), then we will enable the debug action at the time when the client is |
| 470 | // registered. |
| 471 | if (reservation_manager_.buffer_pool_client()->is_registered()) { |
| 472 | RETURN_IF_ERROR(reservation_manager_.EnableDenyReservationDebugAction()); |
| 473 | } |
| 474 | } else { |
| 475 | DCHECK_EQ(debug_options_.action, TDebugAction::DELAY); |
| 476 | int64_t sleep_duration_ms = 100; |
| 477 | RETURN_IF_ERROR( |
| 478 | ParseAndValidateSleepDuration(debug_options_.action_param, &sleep_duration_ms)); |
| 479 | VLOG(1) << "DEBUG_ACTION: Sleeping for " << sleep_duration_ms << "ms"; |
| 480 | SleepForMs(sleep_duration_ms); |
| 481 | } |
| 482 | return Status::OK(); |
| 483 | } |
| 484 | |
| 485 | Status ExecNode::ParseAndValidateSleepDuration( |
| 486 | const string& param, int64_t* sleep_duration_ms) { |
nothing calls this directly
no test coverage detected