Commit 6b47b2fe authored by Sergey Petrunya's avatar Sergey Petrunya

Cassandra Storage Engine: Address review feedback part # 2

- Register counters directly in the array passed to maria_declare_plugin. As 
  a consequence, FLUSH TABLES will reset the counters.
- Update test results accordingly.
parent 7e5ef407
......@@ -74,8 +74,8 @@ Variable_name Value
cassandra_insert_batch_size 100
show status like 'cassandra_row_insert%';
Variable_name Value
Cassandra_row_inserts 8
Cassandra_row_insert_batches 7
Cassandra_row_inserts 8
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
delete from t1;
......@@ -84,14 +84,14 @@ DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
show status like 'cassandra_row_insert%';
Variable_name Value
Cassandra_row_inserts 10
Cassandra_row_insert_batches 8
Cassandra_row_inserts 10
# FLUSH STATUS doesn't work for our variables, just like with InnoDB.
flush status;
show status like 'cassandra_row_insert%';
Variable_name Value
Cassandra_row_inserts 10
Cassandra_row_insert_batches 8
Cassandra_row_insert_batches 0
Cassandra_row_inserts 0
#
# Batched Key Access
#
......@@ -102,8 +102,8 @@ cassandra_multiget_batch_size 100
# MRR-related status variables:
show status like 'cassandra_multi%';
Variable_name Value
Cassandra_multiget_reads 0
Cassandra_multiget_keys_scanned 0
Cassandra_multiget_reads 0
Cassandra_multiget_rows_read 0
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
......@@ -129,8 +129,8 @@ rowkey a rowkey a
9 9 9 9
show status like 'cassandra_multi%';
Variable_name Value
Cassandra_multiget_reads 1
Cassandra_multiget_keys_scanned 10
Cassandra_multiget_reads 1
Cassandra_multiget_rows_read 10
insert into t1 values(1, 8);
insert into t1 values(3, 8);
......@@ -150,8 +150,8 @@ rowkey a rowkey a
9 9 9 9
show status like 'cassandra_multi%';
Variable_name Value
Cassandra_multiget_reads 2
Cassandra_multiget_keys_scanned 16
Cassandra_multiget_reads 2
Cassandra_multiget_rows_read 16
delete from t1;
drop table t1;
......
......@@ -195,31 +195,7 @@ static struct st_mysql_sys_var* cassandra_system_variables[]= {
NULL
};
static SHOW_VAR cassandra_status_variables[]= {
{"row_inserts",
(char*) &cassandra_counters.row_inserts, SHOW_LONG},
{"row_insert_batches",
(char*) &cassandra_counters.row_insert_batches, SHOW_LONG},
{"multiget_reads",
(char*) &cassandra_counters.multiget_reads, SHOW_LONG},
{"multiget_keys_scanned",
(char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG},
{"multiget_rows_read",
(char*) &cassandra_counters.multiget_rows_read, SHOW_LONG},
{"timeout_exceptions",
(char*) &cassandra_counters.timeout_exceptions, SHOW_LONG},
{"unavailable_exceptions",
(char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
Cassandra_status_vars cassandra_counters;
Cassandra_status_vars cassandra_counters_copy;
/**
@brief
......@@ -2581,26 +2557,32 @@ void Cassandra_se_interface::print_error(const char *format, ...)
}
static int show_cassandra_vars(THD *thd, SHOW_VAR *var, char *buff)
{
cassandra_counters_copy= cassandra_counters;
var->type= SHOW_ARRAY;
var->value= (char *) &cassandra_status_variables;
return 0;
}
struct st_mysql_storage_engine cassandra_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
static struct st_mysql_show_var func_status[]=
{
{"Cassandra", (char *)show_cassandra_vars, SHOW_FUNC},
{0,0,SHOW_UNDEF}
static SHOW_VAR cassandra_status_variables[]= {
{"Cassandra_row_inserts",
(char*) &cassandra_counters.row_inserts, SHOW_LONG},
{"Cassandra_row_insert_batches",
(char*) &cassandra_counters.row_insert_batches, SHOW_LONG},
{"Cassandra_multiget_keys_scanned",
(char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG},
{"Cassandra_multiget_reads",
(char*) &cassandra_counters.multiget_reads, SHOW_LONG},
{"Cassandra_multiget_rows_read",
(char*) &cassandra_counters.multiget_rows_read, SHOW_LONG},
{"Cassandra_timeout_exceptions",
(char*) &cassandra_counters.timeout_exceptions, SHOW_LONG},
{"Cassandra_unavailable_exceptions",
(char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
maria_declare_plugin(cassandra)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
......@@ -2611,8 +2593,8 @@ maria_declare_plugin(cassandra)
PLUGIN_LICENSE_GPL,
cassandra_init_func, /* Plugin Init */
cassandra_done_func, /* Plugin Deinit */
0x0001, /* version number (0.1) */
func_status, /* status variables */
0x0001, /* version number (0.1) */
cassandra_status_variables, /* status variables */
cassandra_system_variables, /* system variables */
"0.1", /* string version */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* maturity */
......
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