Skip to content

Add the parameter: metastore.drop-partition-ignore-nonexistent to ignore exceptions when a Hive partition does not exist.#7969

Open
GangYang-HX wants to merge 1 commit into
apache:masterfrom
GangYang-HX:issue-7964
Open

Add the parameter: metastore.drop-partition-ignore-nonexistent to ignore exceptions when a Hive partition does not exist.#7969
GangYang-HX wants to merge 1 commit into
apache:masterfrom
GangYang-HX:issue-7964

Conversation

@GangYang-HX
Copy link
Copy Markdown
Contributor

Fixed a bug that caused the Partition Expire operation to fail due to a non-existent Hive partition.

…ore exceptions when a Hive partition does not exist.
Copy link
Copy Markdown
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments on this PR:

  1. .gitignore change: The .cursor-svg-check/ entry looks unrelated to this PR — likely IDE-specific. Please remove it or put it into a separate commit.

  2. Design question: When MetaException is caught with ignorePartitionNonexistent=true, the code calls partitionExistsInHms() which issues a second HMS RPC (getPartition). If HMS is unhealthy (which is likely the cause of the original MetaException), this verification call may also fail — and the fallback in that case conservatively returns true, causing the original exception to be rethrown anyway. This is a reasonable safety choice, but it means the option won't help when HMS is in a bad state.

    Consider documenting this behavior (i.e., "the option only helps when the specific partition is genuinely absent, not when HMS is having connectivity issues").

  3. Title format: The PR title doesn't follow the project convention of [module] description. Should be something like: [hive] Add metastore.drop-partition-ignore-nonexistent option.

  4. Option naming: The Paimon project typically uses shorter, more consistent option names. metastore.drop-partition-ignore-nonexistent is quite long. Have you considered metastore.drop-partition.ignore-not-exists to be more consistent with other Paimon options?

Comment thread .gitignore
### Tantivy lib ###
*libtantivy_jni*

.cursor-svg-check/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file from the PR

@@ -461,6 +463,20 @@ public void dropPartitions(Identifier identifier, List<Map<String, String>> part
false));
} catch (NoSuchObjectException e) {
// do nothing if the partition not exists
} catch (MetaException e) {
if (ignorePartitionNonexistent
&& !partitionExistsInHms(identifier, partitionValues)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the MetaException returned by HMS is very likely still remaining in the HMS.
Check the processing logic of HMS:
1.ms.getPartition() → OK
2.ms.getDatabase() → NPE,MetaException
3.ms.dropPartition()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Therefore, I suggest that when this configuration is enabled, we ignore HMS errors, log a warning, and then delete the Paimon data.

@lilei1128
Copy link
Copy Markdown
Contributor

close #7964

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants