StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
8.98k stars 1.8k forks source link

[BUG] unable to recover partition from recycle-bin when doing "insert overwrite" #50945

Open rohitrs1983 opened 2 months ago

rohitrs1983 commented 2 months ago

Steps to reproduce the behavior (Required)

mysql> create table test_t1 ( id int(11), name varchar(128), da date ) engine=olap duplicate key(id) partition by range(da)( PARTITION p3 VALUES LESS THAN ('2023-01-01'), PARTITION p4 VALUES LESS THAN ('2024-01-01'), PARTITION p5 VALUES LESS THAN ('2025-01-01') ) distributed by hash(id) buckets 2 properties( "replication_num"="1" );

mysql> insert into test_t1 values(1, 'a', '2022-01-02');

mysql> insert into test_t1 values(2, 'a', '2023-01-02');

mysql> insert into test_t1 values(3, 'a', '2024-01-02');

mysql> select * from test_t1 order by id,name,da; +------+------+------------+ | id | name | da | +------+------+------------+ | 1 | a | 2022-01-02 | | 2 | a | 2023-01-02 | | 3 | a | 2024-01-02 | +------+------+------------+ 3 rows in set (0.04 sec)

mysql> insert overwrite test_t1 values(3, 'a', '2024-01-02');

mysql> select * from test_t1 order by id,name,da; +------+------+------------+ | id | name | da | +------+------+------------+ | 3 | a | 2024-01-02 | +------+------+------------+ 1 row in set (0.04 sec)

mysql> ALTER TABLE test_t1 DROP PARTITION p3 force; Query OK, 0 rows affected (0.01 sec)

mysql> ALTER TABLE test_t1 DROP PARTITION p4 force; Query OK, 0 rows affected (0.01 sec)

mysql> ALTER TABLE test_t1 DROP PARTITION p5 force; Query OK, 0 rows affected (0.01 sec)

mysql> recover partition p3 from test_t1; ERROR 1064 (HY000): No partition named 'p3' in recycle bin that belongs to table 'test_t1' mysql> recover partition p4 from test_t1; ERROR 1064 (HY000): No partition named 'p4' in recycle bin that belongs to table 'test_t1' mysql> recover partition p5 from test_t1;
ERROR 1064 (HY000): No partition named 'p5' in recycle bin that belongs to table 'test_t1' mysql>

Expected behavior (Required)

we should be able to recover the partion from recycle bin

Real behavior (Required)

StarRocks version (Required)

kevincai commented 1 month ago

@rohitrs1983 This should be the designed behavior when doing insert overwrite, the implicit partitions dropped due to insert overwrite is a force drop behavior.

@jaogoy Can you confirm the behavior?