Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Adding dynamic partition failure for one table may block other tables #51440

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

banmoy
Copy link
Contributor

@banmoy banmoy commented Sep 26, 2024

Why I'm doing:

This bug is introduced by #47106. It changes DdlException to SemanticException which leads to DynamicPartitionScheduler.executeDynamicPartitionForTable can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.

A way to reproduce is as following. Create a partition named p20241008 explicitly which will conflict with the dynamic partition to create. Dynamic partition will report exception Getting analyzing error. Detail message: Duplicate partition name p20241008. Note that change p20241008 to the current day you execute the sql.

admin set frontend config ('dynamic_partition_check_interval_seconds' = '5');
admin set frontend config ('default_replication_num' = '1');

create database test;
CREATE TABLE test.site_access1(
    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 p20241008 VALUES LESS THAN ("2020-03-25")
)
DISTRIBUTED BY HASH(event_day, site_id)
PROPERTIES(
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.history_partition_num" = "0"
);

What I'm doing:

catch Exception rather than DdlException in DynamicPartitionScheduler.executeDynamicPartitionForTable

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@banmoy banmoy changed the title [Enhancement] Catch more exceptions when executing dynamic partition [BugFix] Duplicate partition exception will block other tables to create dynamic partition Oct 8, 2024
@banmoy banmoy changed the title [BugFix] Duplicate partition exception will block other tables to create dynamic partition [BugFix] Adding partition failure for one table may block other tables to create dynamic partition Oct 8, 2024
Copy link

sonarcloud bot commented Oct 8, 2024

Copy link

github-actions bot commented Oct 8, 2024

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Oct 8, 2024

[FE Incremental Coverage Report]

pass : 1 / 1 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/clone/DynamicPartitionScheduler.java 1 1 100.00% []

Copy link

github-actions bot commented Oct 8, 2024

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@banmoy banmoy changed the title [BugFix] Adding partition failure for one table may block other tables to create dynamic partition [BugFix] Adding dynamic partition failure for one table may block other tables Oct 9, 2024
@gengjun-git gengjun-git merged commit ca8502a into StarRocks:main Oct 9, 2024
122 checks passed
Copy link

github-actions bot commented Oct 9, 2024

@Mergifyio backport branch-3.3

@github-actions github-actions bot removed the 3.3 label Oct 9, 2024
Copy link
Contributor

mergify bot commented Oct 9, 2024

backport branch-3.3

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Oct 9, 2024
…er tables (#51440)

## Why I'm doing:
This bug is introduced by #47106. It changes [`DdlException` to `SemanticException`](https://github.com/StarRocks/starrocks/pull/47106/files#diff-d823bc00d682d8a36f2257a3ddcfa045cd2f248ef768d7f9fb0c9a53b039d82cR1035) which leads to `DynamicPartitionScheduler.executeDynamicPartitionForTable` can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.

A way to reproduce is as following. Create a partition named  `p20241008` explicitly which will conflict with the dynamic partition to create.  Dynamic partition will report exception `Getting analyzing error. Detail message: Duplicate partition name p20241008`. Note that change `p20241008` to the current day you execute the sql.

```
admin set frontend config ('dynamic_partition_check_interval_seconds' = '5');
admin set frontend config ('default_replication_num' = '1');

create database test;
CREATE TABLE test.site_access1(
    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 p20241008 VALUES LESS THAN ("2020-03-25")
)
DISTRIBUTED BY HASH(event_day, site_id)
PROPERTIES(
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.history_partition_num" = "0"
);
```

## What I'm doing:

catch `Exception` rather than `DdlException` in `DynamicPartitionScheduler.executeDynamicPartitionForTable`

Signed-off-by: PengFei Li <[email protected]>
(cherry picked from commit ca8502a)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/clone/DynamicPartitionScheduler.java
banmoy added a commit to banmoy/starrocks that referenced this pull request Oct 9, 2024
…er tables (StarRocks#51440)

This bug is introduced by StarRocks#47106. It changes [`DdlException` to `SemanticException`](https://github.com/StarRocks/starrocks/pull/47106/files#diff-d823bc00d682d8a36f2257a3ddcfa045cd2f248ef768d7f9fb0c9a53b039d82cR1035) which leads to `DynamicPartitionScheduler.executeDynamicPartitionForTable` can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.

A way to reproduce is as following. Create a partition named  `p20241008` explicitly which will conflict with the dynamic partition to create.  Dynamic partition will report exception `Getting analyzing error. Detail message: Duplicate partition name p20241008`. Note that change `p20241008` to the current day you execute the sql.

```
admin set frontend config ('dynamic_partition_check_interval_seconds' = '5');
admin set frontend config ('default_replication_num' = '1');

create database test;
CREATE TABLE test.site_access1(
    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 p20241008 VALUES LESS THAN ("2020-03-25")
)
DISTRIBUTED BY HASH(event_day, site_id)
PROPERTIES(
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.history_partition_num" = "0"
);
```

catch `Exception` rather than `DdlException` in `DynamicPartitionScheduler.executeDynamicPartitionForTable`

Signed-off-by: PengFei Li <[email protected]>
gengjun-git pushed a commit that referenced this pull request Oct 9, 2024
ZiheLiu pushed a commit to ZiheLiu/starrocks that referenced this pull request Oct 31, 2024
…er tables (StarRocks#51440)

## Why I'm doing:
This bug is introduced by StarRocks#47106. It changes [`DdlException` to `SemanticException`](https://github.com/StarRocks/starrocks/pull/47106/files#diff-d823bc00d682d8a36f2257a3ddcfa045cd2f248ef768d7f9fb0c9a53b039d82cR1035) which leads to `DynamicPartitionScheduler.executeDynamicPartitionForTable` can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.

A way to reproduce is as following. Create a partition named  `p20241008` explicitly which will conflict with the dynamic partition to create.  Dynamic partition will report exception `Getting analyzing error. Detail message: Duplicate partition name p20241008`. Note that change `p20241008` to the current day you execute the sql. 

```
admin set frontend config ('dynamic_partition_check_interval_seconds' = '5');
admin set frontend config ('default_replication_num' = '1');

create database test;
CREATE TABLE test.site_access1(
    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 p20241008 VALUES LESS THAN ("2020-03-25")
)
DISTRIBUTED BY HASH(event_day, site_id)
PROPERTIES(
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.history_partition_num" = "0"
);
```

## What I'm doing:

catch `Exception` rather than `DdlException` in `DynamicPartitionScheduler.executeDynamicPartitionForTable`

Signed-off-by: PengFei Li <[email protected]>
renzhimin7 pushed a commit to renzhimin7/starrocks that referenced this pull request Nov 7, 2024
…er tables (StarRocks#51440)

## Why I'm doing:
This bug is introduced by StarRocks#47106. It changes [`DdlException` to `SemanticException`](https://github.com/StarRocks/starrocks/pull/47106/files#diff-d823bc00d682d8a36f2257a3ddcfa045cd2f248ef768d7f9fb0c9a53b039d82cR1035) which leads to `DynamicPartitionScheduler.executeDynamicPartitionForTable` can't catch the DdlException if adding partition fails. As a result, the current round of scheduling will stop, and other tables' partitions will not be created.

A way to reproduce is as following. Create a partition named  `p20241008` explicitly which will conflict with the dynamic partition to create.  Dynamic partition will report exception `Getting analyzing error. Detail message: Duplicate partition name p20241008`. Note that change `p20241008` to the current day you execute the sql.

```
admin set frontend config ('dynamic_partition_check_interval_seconds' = '5');
admin set frontend config ('default_replication_num' = '1');

create database test;
CREATE TABLE test.site_access1(
    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 p20241008 VALUES LESS THAN ("2020-03-25")
)
DISTRIBUTED BY HASH(event_day, site_id)
PROPERTIES(
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.history_partition_num" = "0"
);
```

## What I'm doing:

catch `Exception` rather than `DdlException` in `DynamicPartitionScheduler.executeDynamicPartitionForTable`

Signed-off-by: PengFei Li <[email protected]>
Signed-off-by: zhiminr.ren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants