Commit d081aa36 authored by Aleksandr Kuzminsky's avatar Aleksandr Kuzminsky

Sync with extensions-1.0.6 Rev. 154

parent d77cc72a
......@@ -4712,6 +4712,10 @@ no_commit:
error = row_insert_for_mysql((byte*) record, prebuilt);
#ifdef EXTENDED_FOR_USERSTAT
if (error == DB_SUCCESS) rows_changed++;
#endif
/* Handle duplicate key errors */
if (auto_inc_used) {
ulint err;
......@@ -5056,6 +5060,10 @@ ha_innobase::update_row(
}
}
#ifdef EXTENDED_FOR_USERSTAT
if (error == DB_SUCCESS) rows_changed++;
#endif
innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(error,
......@@ -5117,6 +5125,10 @@ ha_innobase::delete_row(
error = row_update_for_mysql((byte*) record, prebuilt);
#ifdef EXTENDED_FOR_USERSTAT
if (error == DB_SUCCESS) rows_changed++;
#endif
innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(
......@@ -5649,6 +5661,11 @@ ha_innobase::general_fetch(
case DB_SUCCESS:
error = 0;
table->status = 0;
#ifdef EXTENDED_FOR_USERSTAT
rows_read++;
if (active_index >= 0 && active_index < MAX_KEY)
index_rows_read[active_index]++;
#endif
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_END_OF_FILE;
......
This diff is collapsed.
......@@ -2665,6 +2665,14 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_rseg =
*/
static ST_FIELD_INFO i_s_innodb_table_stats_info[] =
{
{STRUCT_FLD(field_name, "table_schema"),
STRUCT_FLD(field_length, NAME_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "table_name"),
STRUCT_FLD(field_length, NAME_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
......@@ -2710,6 +2718,14 @@ static ST_FIELD_INFO i_s_innodb_table_stats_info[] =
static ST_FIELD_INFO i_s_innodb_index_stats_info[] =
{
{STRUCT_FLD(field_name, "table_schema"),
STRUCT_FLD(field_length, NAME_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "table_name"),
STRUCT_FLD(field_length, NAME_LEN),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
......@@ -2785,16 +2801,30 @@ i_s_innodb_table_stats_fill(
table = UT_LIST_GET_FIRST(dict_sys->table_LRU);
while (table) {
char buf[NAME_LEN * 2 + 2];
char* ptr;
if (table->stat_clustered_index_size == 0) {
table = UT_LIST_GET_NEXT(table_LRU, table);
continue;
}
field_store_string(i_s_table->field[0], table->name);
i_s_table->field[1]->store(table->stat_n_rows);
i_s_table->field[2]->store(table->stat_clustered_index_size);
i_s_table->field[3]->store(table->stat_sum_of_other_index_sizes);
i_s_table->field[4]->store(table->stat_modified_counter);
buf[NAME_LEN * 2 + 1] = 0;
strncpy(buf, table->name, NAME_LEN * 2 + 1);
ptr = strchr(buf, '/');
if (ptr) {
*ptr = '\0';
++ptr;
} else {
ptr = buf;
}
field_store_string(i_s_table->field[0], buf);
field_store_string(i_s_table->field[1], ptr);
i_s_table->field[2]->store(table->stat_n_rows);
i_s_table->field[3]->store(table->stat_clustered_index_size);
i_s_table->field[4]->store(table->stat_sum_of_other_index_sizes);
i_s_table->field[5]->store(table->stat_modified_counter);
if (schema_table_store_record(thd, i_s_table)) {
status = 1;
......@@ -2850,11 +2880,24 @@ i_s_innodb_index_stats_fill(
while (index) {
char buff[256+1];
char row_per_keys[256+1];
char buf[NAME_LEN * 2 + 2];
char* ptr;
ulint i;
field_store_string(i_s_table->field[0], table->name);
field_store_string(i_s_table->field[1], index->name);
i_s_table->field[2]->store(index->n_uniq);
buf[NAME_LEN * 2 + 1] = 0;
strncpy(buf, table->name, NAME_LEN * 2 + 1);
ptr = strchr(buf, '/');
if (ptr) {
*ptr = '\0';
++ptr;
} else {
ptr = buf;
}
field_store_string(i_s_table->field[0], buf);
field_store_string(i_s_table->field[1], ptr);
field_store_string(i_s_table->field[2], index->name);
i_s_table->field[3]->store(index->n_uniq);
row_per_keys[0] = '\0';
if (index->stat_n_diff_key_vals) {
......@@ -2870,10 +2913,10 @@ i_s_innodb_index_stats_fill(
strncat(row_per_keys, buff, 256 - strlen(row_per_keys));
}
}
field_store_string(i_s_table->field[3], row_per_keys);
field_store_string(i_s_table->field[4], row_per_keys);
i_s_table->field[4]->store(index->stat_index_size);
i_s_table->field[5]->store(index->stat_n_leaf_pages);
i_s_table->field[5]->store(index->stat_index_size);
i_s_table->field[6]->store(index->stat_n_leaf_pages);
if (schema_table_store_record(thd, i_s_table)) {
status = 1;
......
......@@ -49,7 +49,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX 6
#ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 10
#define PERCONA_INNODB_VERSION unknown
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment