~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/sql_table.cc

  • Committer: Patrick Galbraith
  • Date: 2008-07-04 15:21:49 UTC
  • mto: (51.1.8 remove-dbug)
  • mto: This revision was merged to the branch mainline in revision 98.
  • Revision ID: patg@ishvara-20080704152149-qv6w3trrq2pjb2nb
Removed DBUG_PRINTs, DBUG_ASSERTs, DBUG_EXECUTE_IFs from
mysqld.cc
sql_table.cc

Still have #ifndef DBUG_OFF blocks, probably should remove them. Also, have 
put the comment /* DBUG WAS HERE */ in some places where I wasn't how to handle removal since the DBUG_PRINT was the only thing in a "if" block.

Show diffs side-by-side

added added

removed removed

Lines of Context:
433
433
  if (successful_open)
434
434
  {
435
435
    global_ddl_log.io_size= uint4korr(&file_entry_buf[DDL_LOG_IO_SIZE_POS]);
436
 
    DBUG_ASSERT(global_ddl_log.io_size <=
 
436
    assert(global_ddl_log.io_size <=
437
437
                sizeof(global_ddl_log.file_entry_buf));
438
438
  }
439
439
  else
610
610
        if (ddl_log_entry->action_type == DDL_LOG_DELETE_ACTION)
611
611
          break;
612
612
      }
613
 
      DBUG_ASSERT(ddl_log_entry->action_type == DDL_LOG_REPLACE_ACTION);
 
613
      assert(ddl_log_entry->action_type == DDL_LOG_REPLACE_ACTION);
614
614
      /*
615
615
        Fall through and perform the rename action of the replace
616
616
        action. We have already indicated the success of the delete
640
640
      break;
641
641
    }
642
642
    default:
643
 
      DBUG_ASSERT(0);
 
643
      assert(0);
644
644
      break;
645
645
  }
646
646
  delete file;
734
734
  global_ddl_log.file_entry_buf[DDL_LOG_PHASE_POS]= 0;
735
735
  int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NEXT_ENTRY_POS],
736
736
            ddl_log_entry->next_entry);
737
 
  DBUG_ASSERT(strlen(ddl_log_entry->name) < FN_LEN);
 
737
  assert(strlen(ddl_log_entry->name) < FN_LEN);
738
738
  strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS],
739
739
          ddl_log_entry->name, FN_LEN - 1);
740
740
  if (ddl_log_entry->action_type == DDL_LOG_RENAME_ACTION ||
741
741
      ddl_log_entry->action_type == DDL_LOG_REPLACE_ACTION)
742
742
  {
743
 
    DBUG_ASSERT(strlen(ddl_log_entry->from_name) < FN_LEN);
 
743
    assert(strlen(ddl_log_entry->from_name) < FN_LEN);
744
744
    strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + FN_LEN],
745
745
          ddl_log_entry->from_name, FN_LEN - 1);
746
746
  }
747
747
  else
748
748
    global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + FN_LEN]= 0;
749
 
  DBUG_ASSERT(strlen(ddl_log_entry->handler_name) < FN_LEN);
 
749
  assert(strlen(ddl_log_entry->handler_name) < FN_LEN);
750
750
  strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + (2*FN_LEN)],
751
751
          ddl_log_entry->handler_name, FN_LEN - 1);
752
752
  if (get_free_ddl_log_entry(active_entry, &write_header))
894
894
        file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= DDL_IGNORE_LOG_ENTRY_CODE;
895
895
      else if (file_entry_buf[DDL_LOG_ACTION_TYPE_POS] == DDL_LOG_REPLACE_ACTION)
896
896
      {
897
 
        DBUG_ASSERT(file_entry_buf[DDL_LOG_PHASE_POS] == 0);
 
897
        assert(file_entry_buf[DDL_LOG_PHASE_POS] == 0);
898
898
        file_entry_buf[DDL_LOG_PHASE_POS]= 1;
899
899
      }
900
900
      else
901
901
      {
902
 
        DBUG_ASSERT(0);
 
902
        assert(0);
903
903
      }
904
904
      if (write_ddl_log_file_entry(entry_no))
905
905
      {
1000
1000
                      read_entry);
1001
1001
      break;
1002
1002
    }
1003
 
    DBUG_ASSERT(ddl_log_entry.entry_type == DDL_LOG_ENTRY_CODE ||
 
1003
    assert(ddl_log_entry.entry_type == DDL_LOG_ENTRY_CODE ||
1004
1004
                ddl_log_entry.entry_type == DDL_IGNORE_LOG_ENTRY_CODE);
1005
1005
 
1006
1006
    if (execute_ddl_log_action(thd, &ddl_log_entry))
1328
1328
      tmp_table_deleted= 1;
1329
1329
      continue;
1330
1330
    case -1:
1331
 
      DBUG_ASSERT(thd->in_sub_stmt);
 
1331
      assert(thd->in_sub_stmt);
1332
1332
      error= 1;
1333
1333
      goto err_with_placeholders;
1334
1334
    default:
1697
1697
    This code came from mysql_prepare_create_table.
1698
1698
    Indent preserved to make patching easier
1699
1699
  */
1700
 
  DBUG_ASSERT(sql_field->charset);
 
1700
  assert(sql_field->charset);
1701
1701
 
1702
1702
  switch (sql_field->sql_type) {
1703
1703
  case MYSQL_TYPE_BLOB:
1962
1962
        int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
1963
1963
                                          (uchar*) comma_buf + 
1964
1964
                                          sizeof(comma_buf));
1965
 
        DBUG_ASSERT(comma_length > 0);
 
1965
        assert(comma_length > 0);
1966
1966
        for (uint i= 0; (tmp= int_it++); i++)
1967
1967
        {
1968
1968
          uint lengthsp;
2034
2034
      else  /* MYSQL_TYPE_ENUM */
2035
2035
      {
2036
2036
        uint32 field_length;
2037
 
        DBUG_ASSERT(sql_field->sql_type == MYSQL_TYPE_ENUM);
 
2037
        assert(sql_field->sql_type == MYSQL_TYPE_ENUM);
2038
2038
        if (sql_field->def != NULL)
2039
2039
        {
2040
2040
          String str, *def= sql_field->def->val_str(&str);
2145
2145
  it.rewind();
2146
2146
  while ((sql_field=it++))
2147
2147
  {
2148
 
    DBUG_ASSERT(sql_field->charset != 0);
 
2148
    assert(sql_field->charset != 0);
2149
2149
 
2150
2150
    if (prepare_create_field(sql_field, &blob_columns, 
2151
2151
                             &timestamps, &timestamps_with_niladic,
2714
2714
                          FIELDFLAG_TREAT_BIT_AS_CHAR;
2715
2715
  }
2716
2716
  sql_field->create_length_to_internal_length();
2717
 
  DBUG_ASSERT(sql_field->def == 0);
 
2717
  assert(sql_field->def == 0);
2718
2718
  /* Can't go wrong as sql_field->def is not defined */
2719
2719
  (void) prepare_blob_field(thd, sql_field);
2720
2720
}
3545
3545
                              RTFC_WAIT_OTHER_THREAD_FLAG |
3546
3546
                              RTFC_CHECK_KILLED_FLAG);
3547
3547
      thd->exit_cond(old_message);
3548
 
      DBUG_EXECUTE_IF("wait_in_mysql_admin_table", wait_for_kill_signal(thd););
3549
3548
      if (thd->killed)
3550
3549
        goto err;
3551
3550
      open_for_modify= 0;
3708
3707
      }
3709
3708
      if (result_code) // either mysql_recreate_table or analyze failed
3710
3709
      {
3711
 
        DBUG_ASSERT(thd->is_error());
 
3710
        assert(thd->is_error());
3712
3711
        if (thd->is_error())
3713
3712
        {
3714
3713
          const char *err_msg= thd->main_da.message();
3888
3887
int reassign_keycache_tables(THD *thd, KEY_CACHE *src_cache,
3889
3888
                             KEY_CACHE *dst_cache)
3890
3889
{
3891
 
  DBUG_ASSERT(src_cache != dst_cache);
3892
 
  DBUG_ASSERT(src_cache->in_init);
 
3890
  assert(src_cache != dst_cache);
 
3891
  assert(src_cache->in_init);
3893
3892
  src_cache->param_buff_size= 0;                // Free key cache
3894
3893
  ha_resize_key_cache(src_cache);
3895
3894
  ha_change_key_cache(src_cache, dst_cache);
4016
4015
 
4017
4016
  strxmov(src_path, src_table->table->s->path.str, reg_ext, NullS);
4018
4017
 
4019
 
  DBUG_EXECUTE_IF("sleep_create_like_before_check_if_exists", my_sleep(6000000););
4020
4018
 
4021
4019
  /* 
4022
4020
    Check that destination tables does not exist. Note that its name
4041
4039
      goto table_exists;
4042
4040
  }
4043
4041
 
4044
 
  DBUG_EXECUTE_IF("sleep_create_like_before_copy", my_sleep(6000000););
4045
4042
 
4046
4043
  /*
4047
4044
    Create a new table by copying from source table
4080
4077
    creation, instead create the table directly (for both normal
4081
4078
    and temporary tables).
4082
4079
  */
4083
 
  DBUG_EXECUTE_IF("sleep_create_like_before_ha_create", my_sleep(6000000););
4084
4080
 
4085
4081
  dst_path[dst_path_length - reg_ext_length]= '\0';  // Remove .frm
4086
4082
  if (thd->variables.keep_files_on_create)
4105
4101
    goto err;       /* purecov: inspected */
4106
4102
  }
4107
4103
 
4108
 
  DBUG_EXECUTE_IF("sleep_create_like_before_binlogging", my_sleep(6000000););
4109
4104
 
4110
4105
  /*
4111
4106
    We have to write the query before we unlock the tables.
4154
4149
        int result= store_create_info(thd, table, &query,
4155
4150
                                               create_info);
4156
4151
 
4157
 
        DBUG_ASSERT(result == 0); // store_create_info() always return 0
 
4152
        assert(result == 0); // store_create_info() always return 0
4158
4153
        write_bin_log(thd, TRUE, query.ptr(), query.length());
4159
4154
      }
4160
4155
      else                                      // Case 1
5005
5000
      state of the TABLE object which we used for obtaining of handler
5006
5001
      object to make it suitable for reopening.
5007
5002
    */
5008
 
    DBUG_ASSERT(t_table == table);
 
5003
    assert(t_table == table);
5009
5004
    table->open_placeholder= 1;
5010
5005
    VOID(pthread_mutex_lock(&LOCK_open));
5011
5006
    close_handle_and_leave_table_as_lock(table);
5648
5643
      VOID(pthread_mutex_lock(&LOCK_open));
5649
5644
      wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
5650
5645
      VOID(pthread_mutex_unlock(&LOCK_open));
5651
 
      DBUG_EXECUTE_IF("sleep_alter_enable_indexes", my_sleep(6000000););
5652
5646
      error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
5653
5647
      /* COND_refresh will be signaled in close_thread_tables() */
5654
5648
      break;
5660
5654
      /* COND_refresh will be signaled in close_thread_tables() */
5661
5655
      break;
5662
5656
    default:
5663
 
      DBUG_ASSERT(FALSE);
 
5657
      assert(FALSE);
5664
5658
      error= 0;
5665
5659
      break;
5666
5660
    }
6082
6076
 
6083
6077
  thd_proc_info(thd, "end");
6084
6078
 
6085
 
  DBUG_EXECUTE_IF("sleep_alter_before_main_binlog", my_sleep(6000000););
6086
 
 
6087
6079
  ha_binlog_log_query(thd, create_info->db_type, LOGCOM_ALTER_TABLE,
6088
6080
                      thd->query, thd->query_length,
6089
6081
                      db, table_name);
6090
6082
 
6091
 
  DBUG_ASSERT(!(mysql_bin_log.is_open() &&
 
6083
  assert(!(mysql_bin_log.is_open() &&
6092
6084
                thd->current_stmt_binlog_row_based &&
6093
6085
                (create_info->options & HA_LEX_CREATE_TMP_TABLE)));
6094
6086
  write_bin_log(thd, TRUE, thd->query, thd->query_length);
6171
6163
        break;
6172
6164
      default:
6173
6165
        /* Shouldn't get here. */
6174
 
        DBUG_ASSERT(0);
 
6166
        assert(0);
6175
6167
    }
6176
6168
    bool save_abort_on_warning= thd->abort_on_warning;
6177
6169
    thd->abort_on_warning= TRUE;