~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

Merge padraig's conflict resolves and trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
2521
2521
                           &handler::ha_optimize));
2522
2522
}
2523
2523
 
2524
 
 
2525
 
/*
2526
 
  Assigned specified indexes for a table into key cache
2527
 
 
2528
 
  SYNOPSIS
2529
 
    mysql_assign_to_keycache()
2530
 
    session             Thread object
2531
 
    tables      Table list (one table only)
2532
 
 
2533
 
  RETURN VALUES
2534
 
   false ok
2535
 
   true  error
2536
 
*/
2537
 
 
2538
 
bool mysql_assign_to_keycache(Session* session, TableList* tables,
2539
 
                             LEX_STRING *key_cache_name)
2540
 
{
2541
 
  HA_CHECK_OPT check_opt;
2542
 
  KEY_CACHE *key_cache;
2543
 
 
2544
 
  check_opt.init();
2545
 
  pthread_mutex_lock(&LOCK_global_system_variables);
2546
 
  if (!(key_cache= get_key_cache(key_cache_name)))
2547
 
  {
2548
 
    pthread_mutex_unlock(&LOCK_global_system_variables);
2549
 
    my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
2550
 
    return(true);
2551
 
  }
2552
 
  pthread_mutex_unlock(&LOCK_global_system_variables);
2553
 
  check_opt.key_cache= key_cache;
2554
 
  return(mysql_admin_table(session, tables, &check_opt,
2555
 
                                "assign_to_keycache", TL_READ_NO_INSERT, 0, 0,
2556
 
                                0, 0, &handler::assign_to_keycache));
2557
 
}
2558
 
 
2559
 
 
2560
 
/*
2561
 
  Reassign all tables assigned to a key cache to another key cache
2562
 
 
2563
 
  SYNOPSIS
2564
 
    reassign_keycache_tables()
2565
 
    session             Thread object
2566
 
    src_cache   Reference to the key cache to clean up
2567
 
    dest_cache  New key cache
2568
 
 
2569
 
  NOTES
2570
 
    This is called when one sets a key cache size to zero, in which
2571
 
    case we have to move the tables associated to this key cache to
2572
 
    the "default" one.
2573
 
 
2574
 
    One has to ensure that one never calls this function while
2575
 
    some other thread is changing the key cache. This is assured by
2576
 
    the caller setting src_cache->in_init before calling this function.
2577
 
 
2578
 
    We don't delete the old key cache as there may still be pointers pointing
2579
 
    to it for a while after this function returns.
2580
 
 
2581
 
 RETURN VALUES
2582
 
    0     ok
2583
 
*/
2584
 
 
2585
 
int reassign_keycache_tables(Session *,
2586
 
                             KEY_CACHE *src_cache,
2587
 
                             KEY_CACHE *dst_cache)
2588
 
{
2589
 
  assert(src_cache != dst_cache);
2590
 
  assert(src_cache->in_init);
2591
 
  src_cache->param_buff_size= 0;                // Free key cache
2592
 
  ha_resize_key_cache(src_cache);
2593
 
  ha_change_key_cache(src_cache, dst_cache);
2594
 
  return 0;
2595
 
}
2596
 
 
2597
2524
static bool mysql_create_like_schema_frm(Session* session,
2598
2525
                                         TableList* schema_table,
2599
2526
                                         HA_CREATE_INFO *create_info,