MySQL Internals Manual  /  Injecting Test Faults  /  Test Fault Macro Usage

25.2 Test Fault Macro Usage

Let us assume the following function:

void function(void) 
{
  DBUG_CRASH_ENTER("function");
  if (DBUG_EVALUATE_IF("process_if", 1, 0))
  {
    DBUG_EXECUTE_IF("process_code", {
      const char *old_proc_info= thd->proc_info;
      thd->proc_info= "DBUG sleep";
      my_sleep(6000000);
      thd->proc_info= old_proc_info;});
  }
  DBUG_CRASH_VOID_RETURN;
}

To crash the server in the fault points defined above, we need to be SUPER user and execute one of the following statements:

  • SET SESSION debug="+d,function_crash_enter"; will crash the server while entering the function.

  • SET SESSION debug="+d,function_crash_return"; will crash the server while returning from function.

  • SET SESSION debug="+d,process_if"; will execute the code inside the if.

  • SET SESSION debug="+d,process_code"; will execute the sleep code.


User Comments
Sign Up Login You must be logged in to post a comment.