]> git.pld-linux.org Git - packages/mysql.git/blob - innodb_extra_rseg.patch
- up to 5.5.9
[packages/mysql.git] / innodb_extra_rseg.patch
1 # name       : innodb_extra_rseg.patch
2 # introduced : 11 or before
3 # maintainer : Yasufumi
4 #
5 #!!! notice !!!
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
8 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
9 --- a/storage/innobase/handler/ha_innodb.cc     2010-12-03 15:18:48.879955903 +0900
10 +++ b/storage/innobase/handler/ha_innodb.cc     2010-12-03 15:22:53.779955671 +0900
11 @@ -11323,6 +11323,11 @@
12    "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
13    NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
14  
15 +static MYSQL_SYSVAR_ULONG(extra_rsegments, srv_extra_rsegments,
16 +  PLUGIN_VAR_RQCMDARG,
17 +  "Number of extra user rollback segments which are used in a round-robin fashion.",
18 +  NULL, NULL, 127, 0, 127, 0);
19 +
20  static struct st_mysql_sys_var* innobase_system_variables[]= {
21    MYSQL_SYSVAR(additional_mem_pool_size),
22    MYSQL_SYSVAR(autoextend_increment),
23 @@ -11387,6 +11392,7 @@
24    MYSQL_SYSVAR(flush_neighbor_pages),
25    MYSQL_SYSVAR(read_ahead),
26    MYSQL_SYSVAR(adaptive_flushing_method),
27 +  MYSQL_SYSVAR(extra_rsegments),
28    MYSQL_SYSVAR(use_sys_malloc),
29    MYSQL_SYSVAR(use_native_aio),
30    MYSQL_SYSVAR(change_buffering),
31 @@ -11415,6 +11421,7 @@
32    innobase_system_variables, /* system variables */
33    NULL /* reserved */
34  },
35 +i_s_innodb_rseg,
36  i_s_innodb_trx,
37  i_s_innodb_locks,
38  i_s_innodb_lock_waits,
39 diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
40 --- a/storage/innobase/handler/i_s.cc   2010-12-03 15:06:58.742986460 +0900
41 +++ b/storage/innobase/handler/i_s.cc   2010-12-03 15:33:08.790070078 +0900
42 @@ -45,6 +45,8 @@
43  #include "srv0start.h" /* for srv_was_started */
44  #include "trx0i_s.h"
45  #include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
46 +#include "trx0rseg.h" /* for trx_rseg_struct */
47 +#include "trx0sys.h" /* for trx_sys */
48  }
49  
50  static const char plugin_author[] = "Innobase Oy";
51 @@ -1781,3 +1783,166 @@
52  
53         DBUG_RETURN(0);
54  }
55 +
56 +/***********************************************************************
57 +*/
58 +static ST_FIELD_INFO   i_s_innodb_rseg_fields_info[] =
59 +{
60 +       {STRUCT_FLD(field_name,         "rseg_id"),
61 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
62 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
63 +        STRUCT_FLD(value,              0),
64 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
65 +        STRUCT_FLD(old_name,           ""),
66 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
67 +
68 +       {STRUCT_FLD(field_name,         "space_id"),
69 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
70 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
71 +        STRUCT_FLD(value,              0),
72 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
73 +        STRUCT_FLD(old_name,           ""),
74 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
75 +
76 +       {STRUCT_FLD(field_name,         "zip_size"),
77 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
78 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
79 +        STRUCT_FLD(value,              0),
80 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
81 +        STRUCT_FLD(old_name,           ""),
82 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
83 +
84 +       {STRUCT_FLD(field_name,         "page_no"),
85 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
86 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
87 +        STRUCT_FLD(value,              0),
88 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
89 +        STRUCT_FLD(old_name,           ""),
90 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
91 +
92 +       {STRUCT_FLD(field_name,         "max_size"),
93 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
94 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
95 +        STRUCT_FLD(value,              0),
96 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
97 +        STRUCT_FLD(old_name,           ""),
98 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
99 +
100 +       {STRUCT_FLD(field_name,         "curr_size"),
101 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
102 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
103 +        STRUCT_FLD(value,              0),
104 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
105 +        STRUCT_FLD(old_name,           ""),
106 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
107 +
108 +       END_OF_ST_FIELD_INFO
109 +};
110 +
111 +static
112 +int
113 +i_s_innodb_rseg_fill(
114 +/*=================*/
115 +       THD*            thd,    /* in: thread */
116 +       TABLE_LIST*     tables, /* in/out: tables to fill */
117 +       COND*           cond)   /* in: condition (ignored) */
118 +{
119 +       TABLE*  table   = (TABLE *) tables->table;
120 +       int     status  = 0;
121 +       trx_rseg_t*     rseg;
122 +
123 +       DBUG_ENTER("i_s_innodb_rseg_fill");
124 +
125 +       /* deny access to non-superusers */
126 +       if (check_global_access(thd, PROCESS_ACL)) {
127 +
128 +               DBUG_RETURN(0);
129 +       }
130 +
131 +       RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
132 +
133 +       rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
134 +
135 +       while (rseg) {
136 +               table->field[0]->store(rseg->id);
137 +               table->field[1]->store(rseg->space);
138 +               table->field[2]->store(rseg->zip_size);
139 +               table->field[3]->store(rseg->page_no);
140 +               table->field[4]->store(rseg->max_size);
141 +               table->field[5]->store(rseg->curr_size);
142 +
143 +               if (schema_table_store_record(thd, table)) {
144 +                       status = 1;
145 +                       break;
146 +               }
147 +
148 +               rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
149 +       }
150 +
151 +       DBUG_RETURN(status);
152 +}
153 +
154 +static
155 +int
156 +i_s_innodb_rseg_init(
157 +/*=================*/
158 +                       /* out: 0 on success */
159 +       void*   p)      /* in/out: table schema object */
160 +{
161 +       DBUG_ENTER("i_s_innodb_rseg_init");
162 +       ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
163 +
164 +       schema->fields_info = i_s_innodb_rseg_fields_info;
165 +       schema->fill_table = i_s_innodb_rseg_fill;
166 +
167 +       DBUG_RETURN(0);
168 +}
169 +
170 +UNIV_INTERN struct st_mysql_plugin     i_s_innodb_rseg =
171 +{
172 +       /* the plugin type (a MYSQL_XXX_PLUGIN value) */
173 +       /* int */
174 +       STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
175 +
176 +       /* pointer to type-specific plugin descriptor */
177 +       /* void* */
178 +       STRUCT_FLD(info, &i_s_info),
179 +
180 +       /* plugin name */
181 +       /* const char* */
182 +       STRUCT_FLD(name, "INNODB_RSEG"),
183 +
184 +       /* plugin author (for SHOW PLUGINS) */
185 +       /* const char* */
186 +       STRUCT_FLD(author, plugin_author),
187 +
188 +       /* general descriptive text (for SHOW PLUGINS) */
189 +       /* const char* */
190 +       STRUCT_FLD(descr, "InnoDB rollback segment information"),
191 +
192 +       /* the plugin license (PLUGIN_LICENSE_XXX) */
193 +       /* int */
194 +       STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
195 +
196 +       /* the function to invoke when plugin is loaded */
197 +       /* int (*)(void*); */
198 +       STRUCT_FLD(init, i_s_innodb_rseg_init),
199 +
200 +       /* the function to invoke when plugin is unloaded */
201 +       /* int (*)(void*); */
202 +       STRUCT_FLD(deinit, i_s_common_deinit),
203 +
204 +       /* plugin version (for SHOW PLUGINS) */
205 +       /* unsigned int */
206 +       STRUCT_FLD(version, 0x0100 /* 1.0 */),
207 +
208 +       /* struct st_mysql_show_var* */
209 +       STRUCT_FLD(status_vars, NULL),
210 +
211 +       /* struct st_mysql_sys_var** */
212 +       STRUCT_FLD(system_vars, NULL),
213 +
214 +       /* reserved for dependency checking */
215 +       /* void* */
216 +       STRUCT_FLD(__reserved1, NULL)
217 +};
218 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
219 --- a/storage/innobase/handler/i_s.h    2010-12-03 15:06:58.744953398 +0900
220 +++ b/storage/innobase/handler/i_s.h    2010-12-03 15:22:53.783953418 +0900
221 @@ -33,5 +33,6 @@
222  extern struct st_mysql_plugin  i_s_innodb_cmp_reset;
223  extern struct st_mysql_plugin  i_s_innodb_cmpmem;
224  extern struct st_mysql_plugin  i_s_innodb_cmpmem_reset;
225 +extern struct st_mysql_plugin  i_s_innodb_rseg;
226  
227  #endif /* i_s_h */
228 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
229 --- a/storage/innobase/include/srv0srv.h        2010-12-03 15:18:48.894029379 +0900
230 +++ b/storage/innobase/include/srv0srv.h        2010-12-03 15:22:53.786986025 +0900
231 @@ -225,6 +225,8 @@
232  extern ulint   srv_read_ahead;
233  extern ulint   srv_adaptive_flushing_method;
234  
235 +extern ulint   srv_extra_rsegments;
236 +
237  /*-------------------------------------------*/
238  
239  extern ulint   srv_n_rows_inserted;
240 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
241 --- a/storage/innobase/srv/srv0srv.c    2010-12-03 15:18:48.913956140 +0900
242 +++ b/storage/innobase/srv/srv0srv.c    2010-12-03 15:22:53.789987037 +0900
243 @@ -413,6 +413,8 @@
244  UNIV_INTERN ulint      srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
245  UNIV_INTERN ulint      srv_read_ahead = 3; /* 1: random  2: linear  3: Both */
246  UNIV_INTERN ulint      srv_adaptive_flushing_method = 0; /* 0: native  1: estimate  2: keep_average */
247 +
248 +UNIV_INTERN ulint      srv_extra_rsegments = 127; /* extra rseg for users */
249  /*-------------------------------------------*/
250  UNIV_INTERN ulong      srv_n_spin_wait_rounds  = 30;
251  UNIV_INTERN ulong      srv_n_free_tickets_to_enter = 500;
252 diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
253 --- a/storage/innobase/trx/trx0trx.c    2010-12-03 15:18:48.918982105 +0900
254 +++ b/storage/innobase/trx/trx0trx.c    2010-12-03 15:22:53.792983193 +0900
255 @@ -619,7 +619,7 @@
256  
257         rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
258  
259 -       if (rseg == NULL) {
260 +       if (rseg == NULL || rseg->id > srv_extra_rsegments) {
261                 rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
262         }
263  
264 @@ -627,7 +627,8 @@
265         it */
266  
267         if ((rseg->id == TRX_SYS_SYSTEM_RSEG_ID)
268 -           && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)) {
269 +           && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)
270 +           && srv_extra_rsegments > 0) {
271                 goto loop;
272         }
273  
This page took 0.059895 seconds and 4 git commands to generate.