~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2009-07-31 05:38:13 UTC
  • mto: (1106.3.2 heap)
  • mto: This revision was merged to the branch mainline in revision 1108.
  • Revision ID: brian@gaz-20090731053813-nip58z7ng0qux5oh
Remove multi key cache

Show diffs side-by-side

added added

removed removed

Lines of Context:
2107
2107
  use_frm= false;
2108
2108
}
2109
2109
 
2110
 
 
2111
 
/*****************************************************************************
2112
 
  Key cache handling.
2113
 
 
2114
 
  This code is only relevant for ISAM/MyISAM tables
2115
 
 
2116
 
  key_cache->cache may be 0 only in the case where a key cache is not
2117
 
  initialized or when we where not able to init the key cache in a previous
2118
 
  call to ha_init_key_cache() (probably out of memory)
2119
 
*****************************************************************************/
2120
 
 
2121
 
/**
2122
 
  Init a key cache if it has not been initied before.
2123
 
*/
2124
 
int ha_init_key_cache(const char *,
2125
 
                      KEY_CACHE *key_cache)
2126
 
{
2127
 
  if (!key_cache->key_cache_inited)
2128
 
  {
2129
 
    pthread_mutex_lock(&LOCK_global_system_variables);
2130
 
    uint32_t tmp_buff_size= (uint32_t) key_cache->param_buff_size;
2131
 
    uint32_t tmp_block_size= (uint32_t) key_cache->param_block_size;
2132
 
    uint32_t division_limit= key_cache->param_division_limit;
2133
 
    uint32_t age_threshold=  key_cache->param_age_threshold;
2134
 
    pthread_mutex_unlock(&LOCK_global_system_variables);
2135
 
    return(!init_key_cache(key_cache,
2136
 
                                tmp_block_size,
2137
 
                                tmp_buff_size,
2138
 
                                division_limit, age_threshold));
2139
 
  }
2140
 
  return 0;
2141
 
}
2142
 
 
2143
 
 
2144
 
/**
2145
 
  Resize key cache.
2146
 
*/
2147
 
int ha_resize_key_cache(KEY_CACHE *key_cache)
2148
 
{
2149
 
  if (key_cache->key_cache_inited)
2150
 
  {
2151
 
    pthread_mutex_lock(&LOCK_global_system_variables);
2152
 
    long tmp_buff_size= (long) key_cache->param_buff_size;
2153
 
    long tmp_block_size= (long) key_cache->param_block_size;
2154
 
    uint32_t division_limit= key_cache->param_division_limit;
2155
 
    uint32_t age_threshold=  key_cache->param_age_threshold;
2156
 
    pthread_mutex_unlock(&LOCK_global_system_variables);
2157
 
    return(!resize_key_cache(key_cache, tmp_block_size,
2158
 
                                  tmp_buff_size,
2159
 
                                  division_limit, age_threshold));
2160
 
  }
2161
 
  return 0;
2162
 
}
2163
 
 
2164
 
 
2165
 
/**
2166
 
  Change parameters for key cache (like size)
2167
 
*/
2168
 
int ha_change_key_cache_param(KEY_CACHE *key_cache)
2169
 
{
2170
 
  if (key_cache->key_cache_inited)
2171
 
  {
2172
 
    pthread_mutex_lock(&LOCK_global_system_variables);
2173
 
    uint32_t division_limit= key_cache->param_division_limit;
2174
 
    uint32_t age_threshold=  key_cache->param_age_threshold;
2175
 
    pthread_mutex_unlock(&LOCK_global_system_variables);
2176
 
    change_key_cache_param(key_cache, division_limit, age_threshold);
2177
 
  }
2178
 
  return 0;
2179
 
}
2180
 
 
2181
 
/**
2182
 
  Free memory allocated by a key cache.
2183
 
*/
2184
 
int ha_end_key_cache(KEY_CACHE *key_cache)
2185
 
{
2186
 
  end_key_cache(key_cache, 1);          // Can never fail
2187
 
  return 0;
2188
 
}
2189
 
 
2190
 
/**
2191
 
  Move all tables from one key cache to another one.
2192
 
*/
2193
 
int ha_change_key_cache(KEY_CACHE *old_key_cache,
2194
 
                        KEY_CACHE *new_key_cache)
2195
 
{
2196
 
  mi_change_key_cache(old_key_cache, new_key_cache);
2197
 
  return 0;
2198
 
}
2199
 
 
2200
 
 
2201
2110
/**
2202
2111
  Calculate cost of 'index only' scan for given index and number of records
2203
2112