Flink: Integrate ConvertEqualityDeletes with IcebergSink#17142
Conversation
This adds the option to run `ConvertEqualityDeletes` as a post-commit maintenance task on `IcebergSink`, similarly to the RewriteDataFiles / ExpireSnapshots / DeleteOrphanFiles post-commit integration. The sink's write branch becomes the converter's staging branch. The target branch defaults to the same branch (in-place conversion). This is also configurable via options on the builder, as well as via properties (see ConvertEqualityDeletesConfig). Equality field columns are derived from the resolved equality field ids of the sink, to ensure they match with the sink's equality fields.
| | flink-maintenance.expire-snapshots.enabled | false | Expire snapshots after commit | | ||
| | flink-maintenance.delete-orphan-files.enabled | false | Delete orphan files after commit | | ||
| | flink-maintenance.convert-equality-deletes.enabled | false | Convert equality deletes to deletion vectors after commit (requires equality fields and format version >= 3) | | ||
| | flink-maintenance.convert-equality-deletes.target-branch | Write branch | Branch the converted DVs are committed to; defaults to the write branch (in-place conversion) | |
There was a problem hiding this comment.
Do we want this here?
Maybe it is enough to keep the detailed config on the flink-maintenance.md
ferenc-csaky
left a comment
There was a problem hiding this comment.
Added 2 nitty comments, the logic itself LGTM
| | flink-maintenance.expire-snapshots.enabled | false | Expire snapshots after commit | | ||
| | flink-maintenance.delete-orphan-files.enabled | false | Delete orphan files after commit | | ||
| | flink-maintenance.convert-equality-deletes.enabled | false | Convert equality deletes to deletion vectors after commit (requires equality fields and format version >= 3) | | ||
| | flink-maintenance.convert-equality-deletes.target-branch | Write branch | Branch the converted DVs are committed to; defaults to the write branch (in-place conversion) | |
There was a problem hiding this comment.
nit: The config option itself has no default value. Maybe it would be less confusing to keep this table in sync with that and put null to the Default table col (based on the read option table) and rephrase the description that something like "if not specified, the write branch will be used (in-place conversion)"
|
|
||
| JobClient jobClient = env.executeAsync("Test Convert Equality Deletes E2E"); | ||
| try { | ||
| Awaitility.await() |
There was a problem hiding this comment.
nit: static import for await(), as it's a widely used lib and a common practice
| flinkConf.put("flink-maintenance.delete-orphan-files.min-age-seconds", "259200"); | ||
|
|
||
| // Configure convert equality deletes. Converts in place on the write branch by default; | ||
| // set a target branch to instead promote the converted deletion vectors there. |
There was a problem hiding this comment.
nit: weird sentence, possible rewording:
// set a target branch to promote the converted deletion vectors there instead.
| - The `RANGE` distribution mode is not yet available for the `IcebergSink` | ||
| - When using `IcebergSink` use `uidSuffix` instead of the `uidPrefix` | ||
|
|
||
| ### Post-commit table maintenance |
There was a problem hiding this comment.
Should we only make this part only in flink-maintenance.md?
| ); | ||
| ``` | ||
|
|
||
| ### IcebergSink Maintenance Configuration (SQL) |
There was a problem hiding this comment.
Should we add related config in this part?
This adds the option to run
ConvertEqualityDeletesas a post-commit maintenance task onIcebergSink, similarly to the RewriteDataFiles / ExpireSnapshots / DeleteOrphanFiles post-commit integration. The sink's write branch becomes the converter's staging branch. The target branch defaults to the same branch (in-place conversion). This is also configurable via options on the builder, as well as via properties (see ConvertEqualityDeletesConfig). Equality field columns are derived from the resolved equality field ids of the sink, to ensure they match with the sink's equality fields.Documentation changes are in separate commits. Ideally, they should be preserved to make backporting of the code changes more straight-forward.