]> git.pld-linux.org Git - packages/mysql.git/blob - innodb_extra_rseg.patch
- up to 5.5.11
[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 @@ -11504,6 +11504,7 @@
12    innobase_system_variables, /* system variables */
13    NULL /* reserved */
14  },
15 +i_s_innodb_rseg,
16  i_s_innodb_trx,
17  i_s_innodb_locks,
18  i_s_innodb_lock_waits,
19 diff -ruN a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
20 --- a/storage/innobase/handler/i_s.cc   2010-12-03 15:06:58.742986460 +0900
21 +++ b/storage/innobase/handler/i_s.cc   2010-12-03 15:33:08.790070078 +0900
22 @@ -45,6 +45,8 @@
23  #include "srv0start.h" /* for srv_was_started */
24  #include "trx0i_s.h"
25  #include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
26 +#include "trx0rseg.h" /* for trx_rseg_struct */
27 +#include "trx0sys.h" /* for trx_sys */
28  }
29  
30  static const char plugin_author[] = "Innobase Oy";
31 @@ -1781,3 +1783,166 @@
32  
33         DBUG_RETURN(0);
34  }
35 +
36 +/***********************************************************************
37 +*/
38 +static ST_FIELD_INFO   i_s_innodb_rseg_fields_info[] =
39 +{
40 +       {STRUCT_FLD(field_name,         "rseg_id"),
41 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
42 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
43 +        STRUCT_FLD(value,              0),
44 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
45 +        STRUCT_FLD(old_name,           ""),
46 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
47 +
48 +       {STRUCT_FLD(field_name,         "space_id"),
49 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
50 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
51 +        STRUCT_FLD(value,              0),
52 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
53 +        STRUCT_FLD(old_name,           ""),
54 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
55 +
56 +       {STRUCT_FLD(field_name,         "zip_size"),
57 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
58 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
59 +        STRUCT_FLD(value,              0),
60 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
61 +        STRUCT_FLD(old_name,           ""),
62 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
63 +
64 +       {STRUCT_FLD(field_name,         "page_no"),
65 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
66 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
67 +        STRUCT_FLD(value,              0),
68 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
69 +        STRUCT_FLD(old_name,           ""),
70 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
71 +
72 +       {STRUCT_FLD(field_name,         "max_size"),
73 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
74 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
75 +        STRUCT_FLD(value,              0),
76 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
77 +        STRUCT_FLD(old_name,           ""),
78 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
79 +
80 +       {STRUCT_FLD(field_name,         "curr_size"),
81 +        STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
82 +        STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
83 +        STRUCT_FLD(value,              0),
84 +        STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
85 +        STRUCT_FLD(old_name,           ""),
86 +        STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
87 +
88 +       END_OF_ST_FIELD_INFO
89 +};
90 +
91 +static
92 +int
93 +i_s_innodb_rseg_fill(
94 +/*=================*/
95 +       THD*            thd,    /* in: thread */
96 +       TABLE_LIST*     tables, /* in/out: tables to fill */
97 +       COND*           cond)   /* in: condition (ignored) */
98 +{
99 +       TABLE*  table   = (TABLE *) tables->table;
100 +       int     status  = 0;
101 +       trx_rseg_t*     rseg;
102 +
103 +       DBUG_ENTER("i_s_innodb_rseg_fill");
104 +
105 +       /* deny access to non-superusers */
106 +       if (check_global_access(thd, PROCESS_ACL)) {
107 +
108 +               DBUG_RETURN(0);
109 +       }
110 +
111 +       RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
112 +
113 +       rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
114 +
115 +       while (rseg) {
116 +               table->field[0]->store(rseg->id);
117 +               table->field[1]->store(rseg->space);
118 +               table->field[2]->store(rseg->zip_size);
119 +               table->field[3]->store(rseg->page_no);
120 +               table->field[4]->store(rseg->max_size);
121 +               table->field[5]->store(rseg->curr_size);
122 +
123 +               if (schema_table_store_record(thd, table)) {
124 +                       status = 1;
125 +                       break;
126 +               }
127 +
128 +               rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
129 +       }
130 +
131 +       DBUG_RETURN(status);
132 +}
133 +
134 +static
135 +int
136 +i_s_innodb_rseg_init(
137 +/*=================*/
138 +                       /* out: 0 on success */
139 +       void*   p)      /* in/out: table schema object */
140 +{
141 +       DBUG_ENTER("i_s_innodb_rseg_init");
142 +       ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
143 +
144 +       schema->fields_info = i_s_innodb_rseg_fields_info;
145 +       schema->fill_table = i_s_innodb_rseg_fill;
146 +
147 +       DBUG_RETURN(0);
148 +}
149 +
150 +UNIV_INTERN struct st_mysql_plugin     i_s_innodb_rseg =
151 +{
152 +       /* the plugin type (a MYSQL_XXX_PLUGIN value) */
153 +       /* int */
154 +       STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
155 +
156 +       /* pointer to type-specific plugin descriptor */
157 +       /* void* */
158 +       STRUCT_FLD(info, &i_s_info),
159 +
160 +       /* plugin name */
161 +       /* const char* */
162 +       STRUCT_FLD(name, "INNODB_RSEG"),
163 +
164 +       /* plugin author (for SHOW PLUGINS) */
165 +       /* const char* */
166 +       STRUCT_FLD(author, plugin_author),
167 +
168 +       /* general descriptive text (for SHOW PLUGINS) */
169 +       /* const char* */
170 +       STRUCT_FLD(descr, "InnoDB rollback segment information"),
171 +
172 +       /* the plugin license (PLUGIN_LICENSE_XXX) */
173 +       /* int */
174 +       STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
175 +
176 +       /* the function to invoke when plugin is loaded */
177 +       /* int (*)(void*); */
178 +       STRUCT_FLD(init, i_s_innodb_rseg_init),
179 +
180 +       /* the function to invoke when plugin is unloaded */
181 +       /* int (*)(void*); */
182 +       STRUCT_FLD(deinit, i_s_common_deinit),
183 +
184 +       /* plugin version (for SHOW PLUGINS) */
185 +       /* unsigned int */
186 +       STRUCT_FLD(version, 0x0100 /* 1.0 */),
187 +
188 +       /* struct st_mysql_show_var* */
189 +       STRUCT_FLD(status_vars, NULL),
190 +
191 +       /* struct st_mysql_sys_var** */
192 +       STRUCT_FLD(system_vars, NULL),
193 +
194 +       /* reserved for dependency checking */
195 +       /* void* */
196 +       STRUCT_FLD(__reserved1, NULL)
197 +};
198 diff -ruN a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
199 --- a/storage/innobase/handler/i_s.h    2010-12-03 15:06:58.744953398 +0900
200 +++ b/storage/innobase/handler/i_s.h    2010-12-03 15:22:53.783953418 +0900
201 @@ -33,5 +33,6 @@
202  extern struct st_mysql_plugin  i_s_innodb_cmp_reset;
203  extern struct st_mysql_plugin  i_s_innodb_cmpmem;
204  extern struct st_mysql_plugin  i_s_innodb_cmpmem_reset;
205 +extern struct st_mysql_plugin  i_s_innodb_rseg;
206  
207  #endif /* i_s_h */
This page took 0.045398 seconds and 4 git commands to generate.