~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2009-08-03 15:48:31 UTC
  • mfrom: (1106.4.3 no-multi-keycache)
  • mto: This revision was merged to the branch mainline in revision 1108.
  • Revision ID: brian@gaz-20090803154831-fngxv9aby0rjkyn9
Merge in removal of multi-keycache code.

Show diffs side-by-side

added added

removed removed

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