File: truncate-stale-6500.test

package info (click to toggle)
mariadb-10.0 10.0.32-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 476,064 kB
  • sloc: cpp: 1,400,131; ansic: 832,140; perl: 54,391; sh: 41,304; pascal: 32,365; yacc: 14,921; xml: 5,257; sql: 4,667; cs: 4,647; makefile: 4,555; ruby: 4,465; python: 2,292; lex: 1,427; java: 941; asm: 295; awk: 54; php: 22; sed: 16
file content (32 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--source include/have_innodb.inc
--source include/have_partition.inc

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=DEFAULT;