apache / apache/hudi

[to be discussed] Allow users to specify that clustering writes should never cause other writers to fail with write conflict (when PreferWriterConflictResolutionStrategy is used)

Open
#17,907 5 comments 0 reactions 0 assignees View on GitHub
type:feature
Dominant language
Java
Stars
6.2k
Forks
2.5k
Avg merge
2d 4h
Merged PRs (30d)
112

Description

### Feature Description

**What the feature achieves:**

Add new new write config values, which will only apply when writers are configured to use write conflict strategy as `PreferWriterConflictResolutionStrategy`.

Note: these config apply to only clustering.

- `wait_for_ingestion_inflight_attempts`/`wait_for_ingestion_inflight_seconds`: After executing clustering plan, before proceeding with committing the clustering, re-load the active timeline to check if there are any non-table service writes in `REQUESTED` state. Until none such instants exist, reload the timeline `wait_for_ingestion_inflight_attempts` times waiting for `wait_for_ingestion_inflight_seconds` seconds between attempts. Once all attempts are exhausted, proceed with committing the cluster. Note that this polling does not happen while the table lock is held.
- `wait_for_ingestion_inflight_attempts`: When committing the clustering, during write conflict resolution, if there are any non-table service writes that are only in a `REQUESTED` state with no workload profile, then fail with a write conflict exception.

In addition, if `PreferWriterConflictResolutionStrategy` is set then HUDI should forcibly override `hoodie.clustering.updates.strategy` to be `org.apache.hudi.client.clustering.update.strategy.SparkAllowUpdateStrategy`. Otherwise non-table service writes will still self-abort when a (inflight) clustering instant is present and targeting the same partition

**Why this feature is needed:**
We want to enforce that if an ingestion (`insert/upsert/insert_overwrite/etc`) write and clustering write target the same partition, the former will never fail due to a write conflict. We use `PreferWriterConflictResolutionStrategy` to achieve this, but the current implementation isn't sufficient for cases where we attempt to cluster older partitions for datasets with upserts (or small file handling enabled). In such scenarios, we want to ensure that the upsert write never fails, even if it means the clustering write repeatedly fails. We have implemented the above configurations and disable them for datasets which only do inserts (Without small file handling). We can upstream our changes once we reach consensus.

### User Experience

**How users will use this feature:**
- Configuration changes needed
- API changes
- Usage examples

### Hudi RFC Requirements

**RFC PR link:** (if applicable)

**Why RFC is/isn't needed:**
- Does this change public interfaces/APIs? (Yes/No)
- Does this change storage format? (Yes/No)
- Justification:

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the clustering write path and the PreferWriterConflictResolutionStrategy behavior described in the issue. Trace the proposed wait_for_ingestion_inflight_attempts and wait_for_ingestion_inflight_seconds settings, including the requested SparkAllowUpdateStrategy override; done means the configuration and conflict behavior are agreed and implemented without causing ingestion writes to fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.