You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "Xinglong Wang (Jira)" <ji...@apache.org> on 2023/04/24 14:23:00 UTC
[jira] [Reopened] (HUDI-6133) Refactor deleteInstant in TimelineService to reduce deletion operation if state is not COMPLETED
[ https://issues.apache.org/jira/browse/HUDI-6133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xinglong Wang reopened HUDI-6133:
---------------------------------
> Refactor deleteInstant in TimelineService to reduce deletion operation if state is not COMPLETED
> ------------------------------------------------------------------------------------------------
>
> Key: HUDI-6133
> URL: https://issues.apache.org/jira/browse/HUDI-6133
> Project: Apache Hudi
> Issue Type: Improvement
> Reporter: Xinglong Wang
> Priority: Minor
>
> Look at the code below, if the state of instant is not `COMPLETED`, it calls `store.deleteInstant` twice:
>
> {code:java}
> public HoodieInstantChangeResult deleteInstant(String db, String tb, THoodieInstant instant) throws MetaserverStorageException, NoSuchObjectException {
> Long tableId = MetaserverTableUtils.getTableId(store, db, tb);
> HoodieInstantChangeResult result = new HoodieInstantChangeResult();
> if (store.instantExists(tableId, instant)) {
> switch (instant.getState()) {
> case COMPLETED:
> store.deleteInstantAllMeta(tableId, instant.getTimestamp());
> break;
> default:
> store.deleteInstant(tableId, instant);
> }
> store.deleteInstant(tableId, instant);
> } else {
> LOG.info("Instant " + instant + " has been already deleted");
> }
> result.setSuccess(true);
> return result;
> } {code}
> So I want to eliminate one deletion operation.
> By the way, it needs to add `IF NOT EXISTS` in DDL, if you want to run unit tests `TestRelationalDBBasedStore` on MySQL more than once.
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)