summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/truncate-stale-6500.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/truncate-stale-6500.test
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--mysql-test/main/truncate-stale-6500.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/main/truncate-stale-6500.test b/mysql-test/main/truncate-stale-6500.test
new file mode 100644
index 00000000..95dc293b
--- /dev/null
+++ b/mysql-test/main/truncate-stale-6500.test
@@ -0,0 +1,33 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+
+set @save_query_cache_size=@@query_cache_size;
+SET GLOBAL query_cache_size=1024*1024*8;
+CREATE TABLE `test` (
+ `uniqueId` INT NOT NULL,
+ `partitionId` INT NOT NULL,
+ PRIMARY KEY (`uniqueId`,`partitionId`)
+) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
+ PARTITION p01 VALUES IN (1),
+ PARTITION p02 VALUES IN (2)
+);
+
+
+INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
+
+SELECT * FROM `test`;
+
+--echo #Confirms 1 row in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+ALTER TABLE `test` TRUNCATE PARTITION `p02`;
+
+--echo #Confirms no more rows in partition 'p02'
+SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
+
+--echo #Before the patch, this returned the previously existing values.
+SELECT * FROM `test`;
+SELECT SQL_CACHE * FROM `test`;
+SELECT SQL_NO_CACHE * FROM `test`;
+
+DROP TABLE test;
+SET GLOBAL query_cache_size=@save_query_cache_size;