starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

[BUG] After a partition is truncated, the number of buckets in the partition changes

Open mklzl opened this issue 3 years ago • 1 comments

Steps to reproduce the behavior (Required)

  1. CREATE TABLE '...'

CREATE TABLE site_access( event_day DATE, site_id INT DEFAULT '10', city_code VARCHAR(100), user_name VARCHAR(32) DEFAULT '', pv BIGINT DEFAULT '0' ) DUPLICATE KEY(event_day, site_id, city_code, user_name) PARTITION BY RANGE(event_day)( PARTITION p20200321 VALUES LESS THAN ("2022-08-08"), PARTITION p20200322 VALUES LESS THAN ("2022-08-09"), PARTITION p20200323 VALUES LESS THAN ("2022-08-10"), PARTITION p20200324 VALUES LESS THAN ("2022-08-11") ) DISTRIBUTED BY HASH(event_day, site_id) BUCKETS 32 PROPERTIES( "dynamic_partition.enable" = "true", "dynamic_partition.time_unit" = "DAY", "dynamic_partition.start" = "-3", "dynamic_partition.end" = "3", "dynamic_partition.prefix" = "p", "dynamic_partition.buckets" = "2" );

  1. show partitions

show partitions from site_access;

  1. some info
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-09]; ..types: [DATE]; keys: [2022-08-10]; ) | event_day, site_id | 32      | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-10]; ..types: [DATE]; keys: [2022-08-11]; ) | event_day, site_id | 32      | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-11]; ..types: [DATE]; keys: [2022-08-12]; ) | event_day, site_id | 2       | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-12]; ..types: [DATE]; keys: [2022-08-13]; ) | event_day, site_id | 2       | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-13]; ..types: [DATE]; keys: [2022-08-14]; ) | event_day, site_id | 2       | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-14]; ..types: [DATE]; keys: [2022-08-15]; ) | event_day, site_id | 2       | 3              | HDD 
  1. truncate partitions and show partitions

truncate table site_access PARTITION(p20220812);

show partitions from site_access;

Expected behavior (Required)

the bucket num of p20220812 is 3

Real behavior (Required)

the bucket num of p20220812 is 32

| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-09]; ..types: [DATE]; keys: [2022-08-10]; ) | event_day, site_id | 32      | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-10]; ..types: [DATE]; keys: [2022-08-11]; ) | event_day, site_id | 32      | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-11]; ..types: [DATE]; keys: [2022-08-12]; ) | event_day, site_id | 2       | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-12]; ..types: [DATE]; keys: [2022-08-13]; ) | event_day, site_id | 32      | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-13]; ..types: [DATE]; keys: [2022-08-14]; ) | event_day, site_id | 2       | 3              | HDD 
| NORMAL | event_day    | [types: [DATE]; keys: [2022-08-14]; ..types: [DATE]; keys: [2022-08-15]; ) | event_day, site_id | 2       | 3              | HDD 

StarRocks version (Required)

  • +-------------------+ | current_version() | +-------------------+ | 2.3.0 a9bdb09 | +-------------------+

mklzl avatar Aug 11 '22 10:08 mklzl

version 2.2.2 has the same problem

zxb2503 avatar Aug 12 '22 06:08 zxb2503

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!

github-actions[bot] avatar Feb 13 '23 11:02 github-actions[bot]