~ubuntu-branches/ubuntu/raring/mysql-5.5/raring-proposed

« back to all changes in this revision

Viewing changes to sql/sys_vars.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-02-14 23:59:22 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120214235922-cux5uek1e5l0hje9
Tags: 5.5.20-0ubuntu1
* New upstream release.
* d/mysql-server-5.5.mysql.upstart: Fix stop on to make sure mysql is
  fully stopped before shutdown commences. (LP: #688541) Also simplify
  start on as it is redundant.
* d/control: Depend on upstart version which has apparmor profile load
  script to prevent failure on upgrade from lucid to precise.
  (LP: #907465)
* d/apparmor-profile: need to allow /run since that is the true path
  of /var/run files. (LP: #917542)
* d/control: mysql-server-5.5 has files in it that used to be owned
  by libmysqlclient-dev, so it must break/replace it. (LP: #912487)
* d/rules, d/control: 5.5.20 Fixes segfault on tests with gcc 4.6,
  change compiler back to system default.
* d/rules: Turn off embedded libedit/readline.(Closes: #659566)

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include "../storage/perfschema/pfs_server.h"
50
50
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
51
51
 
 
52
TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 };
 
53
 
52
54
/*
53
55
  This forward declaration is needed because including sql_base.h
54
56
  causes further includes.  [TODO] Eliminate this forward declaration
56
58
*/
57
59
extern void close_thread_tables(THD *thd);
58
60
 
 
61
 
 
62
static bool update_buffer_size(THD *thd, KEY_CACHE *key_cache,
 
63
                               ptrdiff_t offset, ulonglong new_value)
 
64
{
 
65
  bool error= false;
 
66
  DBUG_ASSERT(offset == offsetof(KEY_CACHE, param_buff_size));
 
67
 
 
68
  if (new_value == 0)
 
69
  {
 
70
    if (key_cache == dflt_key_cache)
 
71
    {
 
72
      my_error(ER_WARN_CANT_DROP_DEFAULT_KEYCACHE, MYF(0));
 
73
      return true;
 
74
    }
 
75
 
 
76
    if (key_cache->key_cache_inited)            // If initied
 
77
    {
 
78
      /*
 
79
        Move tables using this key cache to the default key cache
 
80
        and clear the old key cache.
 
81
      */
 
82
      key_cache->in_init= 1;
 
83
      mysql_mutex_unlock(&LOCK_global_system_variables);
 
84
      key_cache->param_buff_size= 0;
 
85
      ha_resize_key_cache(key_cache);
 
86
      ha_change_key_cache(key_cache, dflt_key_cache);
 
87
      /*
 
88
        We don't delete the key cache as some running threads my still be in
 
89
        the key cache code with a pointer to the deleted (empty) key cache
 
90
      */
 
91
      mysql_mutex_lock(&LOCK_global_system_variables);
 
92
      key_cache->in_init= 0;
 
93
    }
 
94
    return error;
 
95
  }
 
96
 
 
97
  key_cache->param_buff_size= new_value;
 
98
 
 
99
  /* If key cache didn't exist initialize it, else resize it */
 
100
  key_cache->in_init= 1;
 
101
  mysql_mutex_unlock(&LOCK_global_system_variables);
 
102
 
 
103
  if (!key_cache->key_cache_inited)
 
104
    error= ha_init_key_cache(0, key_cache);
 
105
  else
 
106
    error= ha_resize_key_cache(key_cache);
 
107
 
 
108
  mysql_mutex_lock(&LOCK_global_system_variables);
 
109
  key_cache->in_init= 0;
 
110
 
 
111
  return error;
 
112
}
 
113
 
 
114
static bool update_keycache_param(THD *thd, KEY_CACHE *key_cache,
 
115
                                  ptrdiff_t offset, ulonglong new_value)
 
116
{
 
117
  bool error= false;
 
118
  DBUG_ASSERT(offset != offsetof(KEY_CACHE, param_buff_size));
 
119
 
 
120
  keycache_var(key_cache, offset)= new_value;
 
121
 
 
122
  key_cache->in_init= 1;
 
123
  mysql_mutex_unlock(&LOCK_global_system_variables);
 
124
  error= ha_resize_key_cache(key_cache);
 
125
 
 
126
  mysql_mutex_lock(&LOCK_global_system_variables);
 
127
  key_cache->in_init= 0;
 
128
 
 
129
  return error;
 
130
}
 
131
 
59
132
/*
60
133
  The rule for this file: everything should be 'static'. When a sys_var
61
134
  variable or a function from this file is - in very rare cases - needed
1156
1229
       VALID_RANGE(16384, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
1157
1230
       BLOCK_SIZE(1024));
1158
1231
 
 
1232
static Sys_var_ulong Sys_metadata_locks_cache_size(
 
1233
       "metadata_locks_cache_size", "Size of unused metadata locks cache",
 
1234
       READ_ONLY GLOBAL_VAR(mdl_locks_cache_size), CMD_LINE(REQUIRED_ARG),
 
1235
       VALID_RANGE(1, 1024*1024), DEFAULT(MDL_LOCKS_CACHE_SIZE_DEFAULT),
 
1236
       BLOCK_SIZE(1));
 
1237
 
1159
1238
static Sys_var_ulong Sys_pseudo_thread_id(
1160
1239
       "pseudo_thread_id",
1161
1240
       "This variable is for internal server use",
3174
3253
       SESSION_VAR(time_zone), NO_CMD_LINE,
3175
3254
       DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG);
3176
3255
 
 
3256
 
 
3257
/****************************************************************************
 
3258
  Used templates
 
3259
****************************************************************************/
 
3260
 
 
3261
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
 
3262
template class List<set_var_base>;
 
3263
template class List_iterator_fast<set_var_base>;
 
3264
template class Sys_var_unsigned<uint, GET_UINT, SHOW_INT>;
 
3265
template class Sys_var_unsigned<ulong, GET_ULONG, SHOW_LONG>;
 
3266
template class Sys_var_unsigned<ha_rows, GET_HA_ROWS, SHOW_HA_ROWS>;
 
3267
template class Sys_var_unsigned<ulonglong, GET_ULL, SHOW_LONGLONG>;
 
3268
#endif
 
3269