source include/have_rocksdb.inc;

create table t1 (a int primary key) engine=rocksdb;

-- echo Verify rocksdb_rows_inserted
select variable_value into @old_rows_inserted from performance_schema.global_status where variable_name = 'rocksdb_rows_inserted';
insert into t1 values(1);
select variable_value into @new_rows_inserted from performance_schema.global_status where variable_name = 'rocksdb_rows_inserted';
select @new_rows_inserted - @old_rows_inserted;

-- echo Verify rocksdb_rows_updated
select variable_value into @old_rows_updated from performance_schema.global_status where variable_name = 'rocksdb_rows_updated';
update t1 set a=2 where a=1;
select variable_value into @new_rows_updated from performance_schema.global_status where variable_name = 'rocksdb_rows_updated';
select @new_rows_updated - @old_rows_updated;

-- echo Verify rocksdb_rows_read
select variable_value into @old_rows_read from performance_schema.global_status where variable_name = 'rocksdb_rows_read';
select * from t1;
select variable_value into @new_rows_read from performance_schema.global_status where variable_name = 'rocksdb_rows_read';
select @new_rows_read - @old_rows_read;

-- echo Verify rocksdb_rows_deleted
select variable_value into @old_rows_deleted from performance_schema.global_status where variable_name = 'rocksdb_rows_deleted';
delete from t1;
select variable_value into @new_rows_deleted from performance_schema.global_status where variable_name = 'rocksdb_rows_deleted';
select @new_rows_deleted - @old_rows_deleted;

use mysql;
create table t1(a int primary key) engine=rocksdb;

-- echo Verify rocksdb_system_rows_inserted
select variable_value into @old_system_rows_inserted from performance_schema.global_status where variable_name = 'rocksdb_system_rows_inserted';
insert into t1 values(1);
select variable_value into @new_system_rows_inserted from performance_schema.global_status where variable_name = 'rocksdb_system_rows_inserted';
select @new_system_rows_inserted - @old_system_rows_inserted;

-- echo Verify rocksdb_system_rows_updated
select variable_value into @old_system_rows_updated from performance_schema.global_status where variable_name = 'rocksdb_system_rows_updated';
update t1 set a=2 where a=1;
select variable_value into @new_system_rows_updated from performance_schema.global_status where variable_name = 'rocksdb_system_rows_updated';
select @new_system_rows_updated - @old_system_rows_updated;

-- echo Verify rocksdb_system_rows_read
select variable_value into @old_system_rows_read from performance_schema.global_status where variable_name = 'rocksdb_system_rows_read';
select * from t1;
select variable_value into @new_system_rows_read from performance_schema.global_status where variable_name = 'rocksdb_system_rows_read';
select @new_system_rows_read - @old_system_rows_read;

-- echo Verify rocksdb_system_rows_deleted
select variable_value into @old_system_rows_deleted from performance_schema.global_status where variable_name = 'rocksdb_system_rows_deleted';
delete from t1;
select variable_value into @new_system_rows_deleted from performance_schema.global_status where variable_name = 'rocksdb_system_rows_deleted';
select @new_system_rows_deleted - @old_system_rows_deleted;

drop table t1;
use test;
drop table t1;
