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