summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/innodb/t/innodb_information_schema_buffer.test')
-rw-r--r--mysql-test/suite/innodb/t/innodb_information_schema_buffer.test81
1 files changed, 81 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test b/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
new file mode 100644
index 00000000000..b9c6aecd177
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_buffer.test
@@ -0,0 +1,81 @@
+# Exercise the code path for INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS
+# and INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+
+-- source include/have_innodb.inc
+
+if (`select plugin_auth_version <= "1.1.8-29.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.1.8-29.0 or earlier
+}
+
+-- disable_result_log
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
+
+# How many buffer pools we have
+SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
+
+# This gives the over all buffer pool size
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
+
+-- enable_result_log
+
+# Create a table and check its page info behave correctly in the pool
+CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB;
+
+INSERT INTO infoschema_buffer_test VALUES(9);
+
+# We should be able to see this table in the buffer pool if we check
+# right away
+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+WHERE TABLE_NAME like "%infoschema_buffer_test"
+ and PAGE_STATE="file_page" and PAGE_TYPE="index";
+
+# The NUMBER_RECORDS and DATA_SIZE should check with each insertion
+INSERT INTO infoschema_buffer_test VALUES(19);
+
+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+WHERE TABLE_NAME like "%infoschema_buffer_test"
+and PAGE_STATE="file_page" and PAGE_TYPE="index";
+
+CREATE INDEX idx ON infoschema_buffer_test(col1);
+
+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+WHERE TABLE_NAME like "%infoschema_buffer_test"
+and PAGE_STATE="file_page" and INDEX_NAME = "idx" and PAGE_TYPE="index";
+
+
+# Check the buffer after dropping the table
+DROP TABLE infoschema_buffer_test;
+
+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+WHERE TABLE_NAME like "%infoschema_buffer_test";
+
+# Do one more test
+#--replace_regex /'*[0-9]*'/'NUM'/
+CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id))
+ENGINE=INNODB;
+
+CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id),
+ FOREIGN KEY (parent_id)
+ REFERENCES infoschema_parent(id)
+ ON DELETE CASCADE)
+ENGINE=INNODB;
+
+SELECT count(*)
+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
+WHERE TABLE_NAME like "%infoschema_child" and PAGE_STATE="file_page"
+and PAGE_TYPE="index";
+
+DROP TABLE infoschema_child;
+DROP TABLE infoschema_parent;
+
+show create table information_schema.innodb_buffer_page;
+show create table information_schema.innodb_buffer_page_lru;
+show create table information_schema.innodb_buffer_pool_stats;
+