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) 
  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";
      thd->proc_info= old_proc_info;});

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.