~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

  • Committer: Monty Taylor
  • Date: 2009-05-23 00:05:52 UTC
  • mto: (1022.2.34 mordred)
  • mto: This revision was merged to the branch mainline in revision 1039.
  • Revision ID: mordred@inaugust.com-20090523000552-8d1cfu63wl6bguix
Removed the thread-safe crap in MY_BITMAP. Also remove the temp-pool option for
creating a global slow-the-server-down "pool" of temp file names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1185
1185
  if (!(bitmaps= (my_bitmap_map*) alloc_root(&share->mem_root,
1186
1186
                                             share->column_bitmap_size)))
1187
1187
    goto err;
1188
 
  bitmap_init(&share->all_set, bitmaps, share->fields, false);
 
1188
  bitmap_init(&share->all_set, bitmaps, share->fields);
1189
1189
  bitmap_set_all(&share->all_set);
1190
1190
 
1191
1191
  if(handler_file)
1456
1456
  if (!(bitmaps= (unsigned char*) alloc_root(&outparam->mem_root, bitmap_size*3)))
1457
1457
    goto err;
1458
1458
  bitmap_init(&outparam->def_read_set,
1459
 
              (my_bitmap_map*) bitmaps, share->fields, false);
 
1459
              (my_bitmap_map*) bitmaps, share->fields);
1460
1460
  bitmap_init(&outparam->def_write_set,
1461
 
              (my_bitmap_map*) (bitmaps+bitmap_size), share->fields, false);
 
1461
              (my_bitmap_map*) (bitmaps+bitmap_size), share->fields);
1462
1462
  bitmap_init(&outparam->tmp_set,
1463
 
              (my_bitmap_map*) (bitmaps+bitmap_size*2), share->fields, false);
 
1463
              (my_bitmap_map*) (bitmaps+bitmap_size*2), share->fields);
1464
1464
  outparam->default_column_bitmaps();
1465
1465
 
1466
1466
  /* The table struct is now initialized;  Open the table */
1963
1963
{
1964
1964
  uint32_t field_count= s->fields;
1965
1965
 
1966
 
  bitmap_init(&this->def_read_set, (my_bitmap_map*) bitmaps, field_count, false);
1967
 
  bitmap_init(&this->tmp_set, (my_bitmap_map*) (bitmaps+ bitmap_buffer_size(field_count)), field_count, false);
 
1966
  bitmap_init(&this->def_read_set, (my_bitmap_map*) bitmaps, field_count);
 
1967
  bitmap_init(&this->tmp_set, (my_bitmap_map*) (bitmaps+ bitmap_buffer_size(field_count)), field_count);
1968
1968
 
1969
1969
  /* write_set and all_set are copies of read_set */
1970
1970
  def_write_set= def_read_set;
3189
3189
  uint32_t  copy_func_count= param->func_count;
3190
3190
  uint32_t  hidden_null_count, hidden_null_pack_length, hidden_field_count;
3191
3191
  uint32_t  blob_count,group_null_items, string_count;
3192
 
  uint32_t  temp_pool_slot=MY_BIT_NONE;
3193
3192
  uint32_t fieldnr= 0;
3194
3193
  ulong reclength, string_total_length;
3195
3194
  bool  using_unique_constraint= 0;
3210
3209
 
3211
3210
  status_var_increment(session->status_var.created_tmp_tables);
3212
3211
 
3213
 
  if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
3214
 
    temp_pool_slot = bitmap_lock_set_next(&temp_pool);
3215
 
 
3216
 
  if (temp_pool_slot != MY_BIT_NONE) // we got a slot
3217
 
    sprintf(path, "%s_%lx_%i", TMP_FILE_PREFIX,
3218
 
            (unsigned long)current_pid, temp_pool_slot);
3219
 
  else
3220
 
  {
3221
 
    /* if we run out of slots or we are not using tempool */
3222
 
    sprintf(path,"%s%lx_%"PRIx64"_%x", TMP_FILE_PREFIX, (unsigned long)current_pid,
3223
 
            session->thread_id, session->tmp_table++);
3224
 
  }
 
3212
  /* if we run out of slots or we are not using tempool */
 
3213
  sprintf(path,"%s%lx_%"PRIx64"_%x", TMP_FILE_PREFIX, (unsigned long)current_pid,
 
3214
          session->thread_id, session->tmp_table++);
3225
3215
 
3226
3216
  /*
3227
3217
    No need to change table name to lower case as we are only creating
3286
3276
                        &bitmaps, bitmap_buffer_size(field_count)*2,
3287
3277
                        NULL))
3288
3278
  {
3289
 
    if (temp_pool_slot != MY_BIT_NONE)
3290
 
      bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
3291
3279
    return NULL;                                /* purecov: inspected */
3292
3280
  }
3293
3281
  /* Copy_field belongs to Tmp_Table_Param, allocate it in Session mem_root */
3294
3282
  if (!(param->copy_field= copy= new (session->mem_root) Copy_field[field_count]))
3295
3283
  {
3296
 
    if (temp_pool_slot != MY_BIT_NONE)
3297
 
      bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
3298
3284
    free_root(&own_root, MYF(0));               /* purecov: inspected */
3299
3285
    return NULL;                                /* purecov: inspected */
3300
3286
  }
3316
3302
  table->reginfo.lock_type=TL_WRITE;    /* Will be updated */
3317
3303
  table->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE;
3318
3304
  table->map=1;
3319
 
  table->temp_pool_slot = temp_pool_slot;
3320
3305
  table->copy_blobs= 1;
3321
3306
  table->in_use= session;
3322
3307
  table->quick_keys.reset();
3845
3830
err:
3846
3831
  session->mem_root= mem_root_save;
3847
3832
  table->free_tmp_table(session);                    /* purecov: inspected */
3848
 
  if (temp_pool_slot != MY_BIT_NONE)
3849
 
    bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
3850
3833
  return NULL;                          /* purecov: inspected */
3851
3834
}
3852
3835
 
4155
4138
    (*ptr)->free();
4156
4139
  free_io_cache(this);
4157
4140
 
4158
 
  if (temp_pool_slot != MY_BIT_NONE)
4159
 
    bitmap_lock_clear_bit(&temp_pool, temp_pool_slot);
4160
 
 
4161
4141
  free_root(&own_root, MYF(0)); /* the table is allocated in its own root */
4162
4142
  session->set_proc_info(save_proc_info);
4163
4143