summaryrefslogtreecommitdiff
path: root/storage/perfschema/ha_perfschema.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
committerMichael Widenius <monty@askmonty.org>2012-08-01 17:27:34 +0300
commit1d0f70c2f894b27e98773a282871d32802f67964 (patch)
tree833e683e0ced29c4323c29a9d845703d4dfcd81b /storage/perfschema/ha_perfschema.cc
parent5a86a61219826aadf8d08cbc447fe438f2bf50c3 (diff)
downloadmariadb-git-1d0f70c2f894b27e98773a282871d32802f67964.tar.gz
Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6
Diffstat (limited to 'storage/perfschema/ha_perfschema.cc')
-rw-r--r--storage/perfschema/ha_perfschema.cc55
1 files changed, 43 insertions, 12 deletions
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 0fb86cfe5cd..773d822af2b 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -28,6 +28,10 @@
#include "pfs_column_values.h"
#include "pfs_instr_class.h"
#include "pfs_instr.h"
+#include "pfs_account.h"
+#include "pfs_host.h"
+#include "pfs_user.h"
+#include "pfs_account.h"
#ifdef MY_ATOMIC_MODE_DUMMY
/*
@@ -80,7 +84,8 @@ static int pfs_init_func(void *p)
pfs_hton->show_status= pfs_show_status;
pfs_hton->flags= HTON_ALTER_NOT_SUPPORTED |
HTON_TEMPORARY_NOT_SUPPORTED |
- HTON_NO_PARTITION;
+ HTON_NO_PARTITION |
+ HTON_NO_BINLOG_ROW_OPT;
/*
As long as the server implementation keeps using legacy_db_type,
@@ -125,6 +130,8 @@ static struct st_mysql_show_var pfs_status_vars[]=
(char*) &thread_class_lost, SHOW_LONG_NOFLUSH},
{"Performance_schema_file_classes_lost",
(char*) &file_class_lost, SHOW_LONG_NOFLUSH},
+ {"Performance_schema_socket_classes_lost",
+ (char*) &socket_class_lost, SHOW_LONG_NOFLUSH},
{"Performance_schema_mutex_instances_lost",
(char*) &mutex_lost, SHOW_LONG},
{"Performance_schema_rwlock_instances_lost",
@@ -137,6 +144,8 @@ static struct st_mysql_show_var pfs_status_vars[]=
(char*) &file_lost, SHOW_LONG},
{"Performance_schema_file_handles_lost",
(char*) &file_handle_lost, SHOW_LONG},
+ {"Performance_schema_socket_instances_lost",
+ (char*) &socket_lost, SHOW_LONG},
{"Performance_schema_locker_lost",
(char*) &locker_lost, SHOW_LONG},
/* table shares, can be flushed */
@@ -145,6 +154,18 @@ static struct st_mysql_show_var pfs_status_vars[]=
/* table handles, can be flushed */
{"Performance_schema_table_handles_lost",
(char*) &table_lost, SHOW_LONG},
+ {"Performance_schema_hosts_lost",
+ (char*) &host_lost, SHOW_LONG},
+ {"Performance_schema_users_lost",
+ (char*) &user_lost, SHOW_LONG},
+ {"Performance_schema_accounts_lost",
+ (char*) &account_lost, SHOW_LONG},
+ {"Performance_schema_stage_classes_lost",
+ (char*) &stage_class_lost, SHOW_LONG},
+ {"Performance_schema_statement_classes_lost",
+ (char*) &statement_class_lost, SHOW_LONG},
+ {"Performance_schema_digest_lost",
+ (char*) &digest_lost, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
@@ -217,8 +238,6 @@ int ha_perfschema::open(const char *name, int mode, uint test_if_locked)
thr_lock_data_init(m_table_share->m_thr_lock_ptr, &m_thr_lock, NULL);
ref_length= m_table_share->m_ref_length;
- psi_open();
-
DBUG_RETURN(0);
}
@@ -229,8 +248,6 @@ int ha_perfschema::close(void)
delete m_table;
m_table= NULL;
- psi_close();
-
DBUG_RETURN(0);
}
@@ -243,12 +260,7 @@ int ha_perfschema::write_row(uchar *buf)
ha_statistic_increment(&SSV::ha_write_count);
DBUG_ASSERT(m_table_share);
- if (m_table_share->m_write_row)
- result= m_table_share->m_write_row(table, buf, table->field);
- else
- {
- result= HA_ERR_WRONG_COMMAND;
- }
+ result= m_table_share->write_row(table, buf, table->field);
DBUG_RETURN(result);
}
@@ -269,10 +281,21 @@ int ha_perfschema::update_row(const uchar *old_data, uchar *new_data)
DBUG_ENTER("ha_perfschema::update_row");
DBUG_ASSERT(m_table);
+ ha_statistic_increment(&SSV::ha_update_count);
int result= m_table->update_row(table, old_data, new_data, table->field);
DBUG_RETURN(result);
}
+int ha_perfschema::delete_row(const uchar *buf)
+{
+ DBUG_ENTER("ha_perfschema::delete_row");
+
+ DBUG_ASSERT(m_table);
+ ha_statistic_increment(&SSV::ha_delete_count);
+ int result= m_table->delete_row(table, buf, table->field);
+ DBUG_RETURN(result);
+}
+
int ha_perfschema::rnd_init(bool scan)
{
int result;
@@ -287,6 +310,9 @@ int ha_perfschema::rnd_init(bool scan)
else
m_table->reset_position();
+ if (m_table != NULL)
+ m_table->rnd_init(scan);
+
result= m_table ? 0 : HA_ERR_OUT_OF_MEM;
DBUG_RETURN(result);
}
@@ -305,6 +331,8 @@ int ha_perfschema::rnd_next(uchar *buf)
DBUG_ENTER("ha_perfschema::rnd_next");
DBUG_ASSERT(m_table);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
+
int result= m_table->rnd_next();
if (result == 0)
{
@@ -329,6 +357,7 @@ int ha_perfschema::rnd_pos(uchar *buf, uchar *pos)
DBUG_ENTER("ha_perfschema::rnd_pos");
DBUG_ASSERT(m_table);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
int result= m_table->rnd_pos(pos);
if (result == 0)
result= m_table->read_row(table, buf, table->field);
@@ -340,7 +369,7 @@ int ha_perfschema::info(uint flag)
DBUG_ENTER("ha_perfschema::info");
DBUG_ASSERT(m_table_share);
if (flag & HA_STATUS_VARIABLE)
- stats.records= m_table_share->m_records;
+ stats.records= m_table_share->get_row_count();
if (flag & HA_STATUS_CONST)
ref_length= m_table_share->m_ref_length;
DBUG_RETURN(0);
@@ -406,6 +435,8 @@ int ha_perfschema::create(const char *name, TABLE *table_arg,
This is not a general purpose engine.
Failure to CREATE TABLE is the expected result.
*/
+ DBUG_PRINT("error", ("unknown table: %s.%s", table_arg->s->db.str,
+ table_arg->s->table_name.str));
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}