-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
2.1.x
What's Wrong?
cooldownTime in Partition Table not updated after the data cool down
What You Expected?
cooldownTime must reflect the correct cooldown time for the partition, it must be updated according to the date/time with data moving to the remote storage.
How to Reproduce?
CREATE STORAGE POLICY hour_pol
PROPERTIES(
"storage_resource" = "hot_to_cold",
"cooldown_ttl" = "1h"
);
create database test;
use test
CREATE TABLE `customer1` (
`c_custkey` INT NOT NULL,
`c_name` VARCHAR(25) NOT NULL,
`c_address` VARCHAR(40) NOT NULL,
`c_nationkey` INT NOT NULL,
`c_phone` VARCHAR(15) NOT NULL,
`c_acctbal` DECIMAL(15, 2) NOT NULL,
`c_mktsegment` VARCHAR(10) NOT NULL,
`c_comment` VARCHAR(117) NOT NULL
) ENGINE=OLAP
DUPLICATE KEY(`c_custkey`)
PARTITION BY RANGE(`c_custkey`)
(
PARTITION `p1000` VALUES LESS THAN (1000),
PARTITION `p2000` VALUES LESS THAN (2000),
PARTITION `p3000` VALUES LESS THAN (3000),
PARTITION `p4000` VALUES LESS THAN (4000),
PARTITION `p5000` VALUES LESS THAN (5000),
PARTITION `p6000` VALUES LESS THAN (6000)
)
DISTRIBUTED BY HASH(`c_custkey`) BUCKETS 24
PROPERTIES (
"replication_num" = "3",
"storage_policy" = "hour_pol"
);
INSERT INTO customer1 (`c_custkey`, `c_name`, `c_address`, `c_nationkey`, `c_phone`, `c_acctbal`, `c_mktsegment`, `c_comment`) VALUES
(1001, 'Alice Müller', 'Bergstraße 21, Berlin', 3, '+49-30-123456', 5420.75, 'AUTOMOBILE', 'Uzun süredir sadık müşteri.'),
(1450, 'Bob Schmidt', 'Goethestraße 10, Frankfurt', 7, '+49-69-987654', 320.00, 'TECHNOLOGY', 'Yeni ürünlerle ilgileniyor.'),
(2345, 'Clara Weber', 'Hauptstraße 5, Köln', 2, '+49-221-998877', 12000.00, 'FINANCE', 'Premium segment hedeflenmeli.'),
(2999, 'David Becker', 'Marktplatz 3, München', 5, '+49-89-112233', 50.20, 'RETAIL', 'Promosyonlara açık.'),
(3755, 'Emma König', 'Bahnhofstraße 8, Stuttgart', 9, '+49-711-334455', 760.50, 'TRAVEL', 'Yıl boyunca düzenli sipariş verir.'),
(4899, 'Felix Fischer', 'Ringstraße 12, Hamburg', 4, '+49-40-556677', 9999.99, 'HEALTHCARE', 'Tavsiye programına dahil edilebilir.');
Anything Else?
### SHOW PARTITIONS Output After Cooldown
mysql> show partitions from customer1;
+-------------+---------------+----------------+---------------------+--------+--------------+---------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
| PartitionId | PartitionName | VisibleVersion | VisibleVersionTime | State | PartitionKey | Range | DistributionKey | Buckets | ReplicationNum | StorageMedium | CooldownTime | RemoteStoragePolicy | LastConsistencyCheckTime | DataSize | IsInMemory | ReplicaAllocation | IsMutable |
+-------------+---------------+----------------+---------------------+--------+--------------+---------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
| 98295 | p1000 | 3 | 2025-07-23 13:29:02 | NORMAL | c_custkey | [types: [INT]; keys: [-2147483648]; ..types: [INT]; keys: [1000]; ) | c_custkey | 24 | 3 | HDD | 9999-12-31 23:59:59 | hour_pol | NULL | 0.000 | false | tag.location.default: 3 | true |
| 98296 | p2000 | 2 | 2025-07-23 13:29:02 | NORMAL | c_custkey | [types: [INT]; keys: [1000]; ..types: [INT]; keys: [2000]; ) | c_custkey | 24 | 3 | HDD | 9999-12-31 23:59:59 | min_15 | NULL | 0.000 | false | tag.location.default: 3 | true |
| 98297 | p3000 | 1 | 2025-07-23 13:27:32 | NORMAL | c_custkey | [types: [INT]; keys: [2000]; ..types: [INT]; keys: [3000]; ) | c_custkey | 24 | 3 | HDD | 9999-12-31 23:59:59 | hour_pol | NULL | 0.000 | false | tag.location.default: 3 | true |
| 98298 | p4000 | 1 | 2025-07-23 13:27:32 | NORMAL | c_custkey | [types: [INT]; keys: [3000]; ..types: [INT]; keys: [4000]; ) | c_custkey | 24 | 3 | HDD | 9999-12-31 23:59:59 | hour_pol | NULL | 0.000 | false | tag.location.default: 3 | true |
| 98299 | p5000 | 1 | 2025-07-23 13:27:32 | NORMAL | c_custkey | [types: [INT]; keys: [4000]; ..types: [INT]; keys: [5000]; ) | c_custkey | 24 | 3 | HDD | 9999-12-31 23:59:59 | hour_pol | NULL | 0.000 | false | tag.location.default: 3 | true |
| 98300 | p6000 | 1 | 2025-07-23 13:27:32 | NORMAL | c_custkey | [types: [INT]; keys: [5000]; ..types: [INT]; keys: [6000]; ) | c_custkey | 24 | 3 | HDD | 9999-12-31 23:59:59 | hour_pol | NULL | 0.000 | false | tag.location.default: 3 | true |
+-------------+---------------+----------------+---------------------+--------+--------------+---------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
6 rows in set (0.01 sec)
### SHOW DATA Output After Cooldown (All Data in Remote Storage)

Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct