1114
1109
static const char *load_default_groups[]= {
1115
1110
DRIZZLE_CONFIG_NAME, "server", 0, 0};
1117
SHOW_VAR com_status_vars[]= {
1112
static int show_starttime(SHOW_VAR *var, char *buff)
1114
var->type= SHOW_LONG;
1116
*((long *)buff)= (long) (time(NULL) - server_start_time);
1120
static int show_flushstatustime(SHOW_VAR *var, char *buff)
1122
var->type= SHOW_LONG;
1124
*((long *)buff)= (long) (time(NULL) - flush_status_time);
1128
static int show_open_tables(SHOW_VAR *var, char *buff)
1130
var->type= SHOW_LONG;
1132
*((long *)buff)= (long)cached_open_tables();
1136
static int show_table_definitions(SHOW_VAR *var, char *buff)
1138
var->type= SHOW_LONG;
1140
*((long *)buff)= (long)cached_table_definitions();
1144
static st_show_var_func_container
1145
show_open_tables_cont= { &show_open_tables };
1146
static st_show_var_func_container
1147
show_table_definitions_cont= { &show_table_definitions };
1148
static st_show_var_func_container
1149
show_starttime_cont= { &show_starttime };
1150
static st_show_var_func_container
1151
show_flushstatustime_cont= { &show_flushstatustime };
1154
Variables shown by SHOW STATUS in alphabetical order
1156
static SHOW_VAR com_status_vars[]= {
1118
1157
{"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
1119
1158
{"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
1120
1159
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
1167
1206
{NULL, NULL, SHOW_LONGLONG}
1209
static SHOW_VAR status_vars[]= {
1210
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONGLONG},
1211
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONGLONG},
1212
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS},
1213
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
1214
{"Com", (char*) com_status_vars, SHOW_ARRAY},
1215
{"Connections", (char*) &global_thread_id, SHOW_INT_NOFLUSH},
1216
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS},
1217
{"Created_tmp_files", (char*) &my_tmp_file_created,SHOW_INT},
1218
{"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables), SHOW_LONG_STATUS},
1219
{"Flush_commands", (char*) &refresh_version, SHOW_INT_NOFLUSH},
1220
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
1221
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
1222
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
1223
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
1224
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
1225
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
1226
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS},
1227
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS},
1228
{"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR, ha_read_rnd_next_count), SHOW_LONG_STATUS},
1229
{"Handler_rollback", (char*) offsetof(STATUS_VAR, ha_rollback_count), SHOW_LONG_STATUS},
1230
{"Handler_savepoint", (char*) offsetof(STATUS_VAR, ha_savepoint_count), SHOW_LONG_STATUS},
1231
{"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS},
1232
{"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS},
1233
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS},
1234
{"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG},
1235
{"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG},
1236
{"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG},
1237
{"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG},
1238
{"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG},
1239
{"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG},
1240
{"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG},
1241
{"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS},
1242
{"Max_used_connections", (char*) &max_used_connections, SHOW_INT},
1243
{"Open_files", (char*) &my_file_opened, SHOW_INT_NOFLUSH},
1244
{"Open_streams", (char*) &my_stream_opened, SHOW_INT_NOFLUSH},
1245
{"Open_table_definitions", (char*) &show_table_definitions_cont, SHOW_FUNC},
1246
{"Open_tables", (char*) &show_open_tables_cont, SHOW_FUNC},
1247
{"Opened_files", (char*) &my_file_total_opened, SHOW_INT_NOFLUSH},
1248
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
1249
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
1250
{"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS},
1251
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS},
1252
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS},
1253
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
1254
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
1255
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
1256
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
1257
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
1258
{"Sort_range", (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS},
1259
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS},
1260
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
1261
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_INT},
1262
{"Table_locks_waited", (char*) &locks_waited, SHOW_INT},
1263
{"Threads_connected", (char*) &connection_count, SHOW_INT},
1264
{"Uptime", (char*) &show_starttime_cont, SHOW_FUNC},
1265
{"Uptime_since_flush_status",(char*) &show_flushstatustime_cont, SHOW_FUNC},
1266
{NULL, NULL, SHOW_LONGLONG}
1170
1269
static int init_common_variables(const char *conf_file_name, int argc,
1171
1270
char **argv, const char **groups)
2046
2144
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
2049
static int show_starttime(SHOW_VAR *var, char *buff)
2051
var->type= SHOW_LONG;
2053
*((uint32_t *)buff)= (uint32_t) (time(NULL) - server_start_time);
2057
static st_show_var_func_container
2058
show_starttime_cont= { &show_starttime };
2060
static int show_flushstatustime(SHOW_VAR *var, char *buff)
2062
var->type= SHOW_LONG;
2064
*((uint32_t *)buff)= (uint32_t) (time(NULL) - flush_status_time);
2068
static st_show_var_func_container
2069
show_flushstatustime_cont= { &show_flushstatustime };
2071
static int show_open_tables(SHOW_VAR *var, char *buff)
2073
var->type= SHOW_LONG;
2075
*((uint32_t *)buff)= (uint32_t)cached_open_tables();
2079
static int show_table_definitions(SHOW_VAR *var, char *buff)
2081
var->type= SHOW_LONG;
2083
*((uint32_t *)buff)= (uint32_t)cached_table_definitions();
2087
static st_show_var_func_container
2088
show_open_tables_cont= { &show_open_tables };
2089
static st_show_var_func_container
2090
show_table_definitions_cont= { &show_table_definitions };
2093
Variables shown by SHOW STATUS in alphabetical order
2096
SHOW_VAR status_vars[]= {
2097
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONGLONG},
2098
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONGLONG},
2099
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS},
2100
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
2101
{"Com", (char*) com_status_vars, SHOW_ARRAY},
2102
{"Connections", (char*) &global_thread_id, SHOW_INT_NOFLUSH},
2103
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS},
2104
{"Created_tmp_files", (char*) &my_tmp_file_created,SHOW_INT},
2105
{"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables), SHOW_LONG_STATUS},
2106
{"Flush_commands", (char*) &refresh_version, SHOW_INT_NOFLUSH},
2107
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
2108
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
2109
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
2110
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
2111
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
2112
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
2113
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS},
2114
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS},
2115
{"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR, ha_read_rnd_next_count), SHOW_LONG_STATUS},
2116
{"Handler_rollback", (char*) offsetof(STATUS_VAR, ha_rollback_count), SHOW_LONG_STATUS},
2117
{"Handler_savepoint", (char*) offsetof(STATUS_VAR, ha_savepoint_count), SHOW_LONG_STATUS},
2118
{"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS},
2119
{"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS},
2120
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS},
2121
{"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG},
2122
{"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG},
2123
{"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG},
2124
{"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG},
2125
{"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG},
2126
{"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG},
2127
{"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG},
2128
{"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS},
2129
{"Max_used_connections", (char*) &max_used_connections, SHOW_INT},
2130
{"Open_files", (char*) &my_file_opened, SHOW_INT_NOFLUSH},
2131
{"Open_streams", (char*) &my_stream_opened, SHOW_INT_NOFLUSH},
2132
{"Open_table_definitions", (char*) &show_table_definitions_cont, SHOW_FUNC},
2133
{"Open_tables", (char*) &show_open_tables_cont, SHOW_FUNC},
2134
{"Opened_files", (char*) &my_file_total_opened, SHOW_INT_NOFLUSH},
2135
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
2136
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
2137
{"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS},
2138
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS},
2139
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS},
2140
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
2141
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
2142
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
2143
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
2144
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
2145
{"Sort_range", (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS},
2146
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS},
2147
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
2148
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_INT},
2149
{"Table_locks_waited", (char*) &locks_waited, SHOW_INT},
2150
{"Threads_connected", (char*) &connection_count, SHOW_INT},
2151
{"Uptime", (char*) &show_starttime_cont, SHOW_FUNC},
2152
{"Uptime_since_flush_status",(char*) &show_flushstatustime_cont, SHOW_FUNC},
2153
{NULL, NULL, SHOW_LONGLONG}
2156
2147
static void print_version(void)