You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2026/10/23 16:01:06 UTC
[PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
zeroshade opened a new pull request, #2302:
URL: https://github.com/apache/iceberg-go/pull/2302
### Problem
Partial-progress `RewriteDataFiles` can bring back rows that a concurrent writer deleted.
Groups are planned once, then committed batch by batch, and each batch starts from the table the previous batch committed (`recordCommittedRewriteBatch`). With `commit.retry.num-retries` > 0:
1. A peer commits a position delete P for data file F while batch 1 is committing. F belongs to batch 2.
2. Batch 1's first attempt fails on the stale branch head. The retry runs the rewrite validator for batch 1's files only, finds no conflict, and commits on top of the peer snapshot.
3. Batch 2's transaction starts from that table, so P is part of its base and its commit-time validator never examines it.
4. Batch 2 rewrites F from tasks planned before P existed, so the deleted rows are written into the new file. `CollectDeadPositionDeletes` then finds P pointing at a rewritten file and removes it as dead.
The same applies to a deletion vector for F, which goes through the same validator branch. Equality deletes are not affected, because any concurrent equality delete fails the batch that would absorb it.
Without retries, batch 1 fails on the stale head and so does every later batch, so nothing is lost. A non-partial rewrite validates the whole window and is rejected with `ErrConflictingDeleteFiles`.
### Fix
Before rewriting a batch, `validateNoNewDeletesSincePlanning` runs `validateNoNewDeletesForRewrittenFiles` over every snapshot committed on the branch between the planning metadata and the current table. Together with the existing commit-time validator, which covers current to the catalog head, every snapshot since planning is now checked.
A conflicting batch is handled like a failed commit: its groups go to `FailedGroups` with `ErrConflictingDeleteFiles`, it counts toward `MaxFailedCommits`, and the run continues. The check runs before the batch is executed, so nothing is written for it. The `MaxFailedCommits` doc now mentions these rejections.
### Testing
`TestRewriteDataFiles_PartialProgressRejectsDeleteAbsorbedByEarlierBatch` uses a one-shot `beforeCommit` hook on `concurrentTestCatalog` to land a file-scoped position delete for a batch-2 file just before batch 1 commits. It checks that batch 1 completes, batch 2 fails with `ErrConflictingDeleteFiles`, the deleted row stays deleted, the delete stays live, and the rejected batch leaves no outputs. Without the fix, both groups complete and the deleted row comes back.
`go test ./table/... ./cmd/iceberg/...` passes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "laskoviymishka (via GitHub)" <gi...@apache.org>.
laskoviymishka commented on code in PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#discussion_r4421971737
##########
table/rewrite_data_files_test.go:
##########
@@ -791,6 +791,144 @@ func TestRewriteDataFiles_PartialProgressRetainsSharedPositionDeleteAfterFailure
"generated files from tolerated failed batches must be removed")
}
+// TestRewriteDataFiles_PartialProgressRejectsDeleteAbsorbedByEarlierBatch
+// lands a peer position delete for a batch-2 data file just before batch 1
+// commits. Batch 1's retry rebases onto the peer snapshot without conflict,
+// since the delete targets a file batch 1 does not rewrite. Batch 2's tasks
+// were planned before the delete existed and its transaction starts from
+// batch 1's table, so only a check back to the planning snapshot can stop it
+// from rewriting the file without the delete and then dropping the delete as
+// dead, which would bring the deleted row back.
+func TestRewriteDataFiles_PartialProgressRejectsDeleteAbsorbedByEarlierBatch(t *testing.T) {
+ tbl, cat, groups, posDelPaths := newAbsorbedDeleteFixture(t, 2, 1)
+ posDelPath := posDelPaths[0]
+
+ beforeFiles := parquetFiles(t, tbl.Location())
+ tx := tbl.NewTransaction()
+ result, err := tx.RewriteDataFiles(t.Context(), groups, table.RewriteDataFilesOptions{
+ PartialProgress: true,
+ MaxCommits: 2,
+ })
+ require.NoError(t, err)
+ require.Nil(t, cat.beforeCommit, "the peer commit must have landed during the rewrite")
+
+ require.Len(t, result.CompletedGroups, 1)
+ assert.Equal(t, "absorbed-group-0", result.CompletedGroups[0].PartitionKey)
+ require.Len(t, result.FailedGroups, 1)
+ assert.Equal(t, "absorbed-group-1", result.FailedGroups[0].PartitionKey)
+ assert.ErrorIs(t, result.FailedGroups[0].Err, table.ErrConflictingDeleteFiles)
+ assert.Zero(t, result.RemovedPositionDeleteFiles)
+
+ final, err := cat.LoadTable(t.Context(), tbl.Identifier())
+ require.NoError(t, err)
+ assertRowCount(t, final, 3)
+ finalTasks, err := final.Scan().PlanFiles(t.Context())
+ require.NoError(t, err)
+ var liveDeletes int
+ for _, task := range finalTasks {
+ liveDeletes += len(task.DeleteFiles)
+ }
+ assert.Equal(t, 1, liveDeletes, "the peer's position delete must stay live")
+
+ // The rejected batch is detected before it writes anything.
+ expectedFiles := append([]string{posDelPath}, beforeFiles...)
+ for _, file := range result.CompletedGroups[0].NewDataFiles {
+ expectedFiles = append(expectedFiles, file.FilePath())
+ }
+ assert.ElementsMatch(t, expectedFiles, parquetFiles(t, tbl.Location()),
+ "the rejected batch must not leave compacted outputs behind")
+}
+
+// TestRewriteDataFiles_PartialProgressRejectedBatchesCountTowardMaxFailedCommits
+// rejects two batches through the planning-snapshot check and asserts that
+// they count toward MaxFailedCommits like catalog commit failures do.
+func TestRewriteDataFiles_PartialProgressRejectedBatchesCountTowardMaxFailedCommits(t *testing.T) {
+ tbl, cat, groups, _ := newAbsorbedDeleteFixture(t, 3, 1, 2)
+
+ tx := tbl.NewTransaction()
+ result, err := tx.RewriteDataFiles(t.Context(), groups, table.RewriteDataFilesOptions{
+ PartialProgress: true,
+ MaxCommits: 3,
+ MaxFailedCommits: 1,
+ })
+ require.Nil(t, cat.beforeCommit, "the peer commit must have landed during the rewrite")
+ require.ErrorIs(t, err, table.ErrConflictingDeleteFiles)
+ assert.ErrorContains(t, err, "maximum failed commits reached")
+ require.Len(t, result.CompletedGroups, 1)
+ assert.Equal(t, "absorbed-group-0", result.CompletedGroups[0].PartitionKey)
+ require.Len(t, result.FailedGroups, 2)
+}
+
+// newAbsorbedDeleteFixture writes n two-row data files, each committed on its
+// own, and returns one compaction group per file in path order. Before the
+// rewrite's first catalog commit, a peer commits one file-scoped position
+// delete (row 0) for each data file index in deleteTargets. Index 0's batch
+// commits first, so targets must be greater than 0 to be absorbed by an
+// earlier batch.
+func newAbsorbedDeleteFixture(t *testing.T, n int, deleteTargets ...int) (*table.Table, *concurrentTestCatalog, []table.CompactionTaskGroup, []string) {
+ t.Helper()
+ tbl, cat := newConcurrentRewriteTestTable(t)
+ arrowSc, err := table.SchemaToArrowSchema(tbl.Schema(), nil, false, false)
+ require.NoError(t, err)
+
+ paths := make([]string, n)
+ for i := range paths {
+ paths[i] = tbl.Location() + fmt.Sprintf("/data/absorbed-%d.parquet", i)
+ writeParquetFile(t, paths[i], arrowSc, fmt.Sprintf(
+ `[{"id": %d, "data": "a"}, {"id": %d, "data": "b"}]`, i*2+1, i*2+2))
+
+ tx := tbl.NewTransaction()
+ require.NoError(t, tx.AddDataFilesByPath(t.Context(), []string{paths[i]}, nil, false))
+ tbl, err = tx.Commit(t.Context())
+ require.NoError(t, err)
+ }
+
+ tasks, err := tbl.Scan().PlanFiles(t.Context())
+ require.NoError(t, err)
+ require.Len(t, tasks, n)
+ taskByPath := make(map[string]table.FileScanTask, len(tasks))
+ for _, task := range tasks {
+ taskByPath[task.File.FilePath()] = task
+ }
+ groups := make([]table.CompactionTaskGroup, 0, n)
+ for i, path := range paths {
+ task := taskByPath[path]
+ groups = append(groups, table.CompactionTaskGroup{
+ PartitionKey: fmt.Sprintf("absorbed-group-%d", i),
+ Tasks: []table.FileScanTask{task},
+ TotalSizeBytes: task.File.FileSizeBytes(),
+ })
+ }
+
+ // Equal file_path bounds make each delete file-scoped, so the earlier
+ // batch's validator ignores it.
+ posDelPaths := make([]string, len(deleteTargets))
+ for i, target := range deleteTargets {
+ posDelPaths[i] = tbl.Location() + fmt.Sprintf("/data/absorbed-peer-delete-%d.parquet", target)
+ }
+ cat.beforeCommit = func() {
+ peer, err := cat.LoadTable(t.Context(), tbl.Identifier())
+ require.NoError(t, err)
+ peerTx := peer.NewTransaction()
+ delta := peerTx.NewRowDelta(nil)
+ for i, target := range deleteTargets {
+ writeParquetFile(t, posDelPaths[i], table.PositionalDeleteArrowSchema,
+ fmt.Sprintf(`[{"file_path": "%s", "pos": 0}]`, paths[target]))
+ builder, err := iceberg.NewDataFileBuilder(
+ *iceberg.UnpartitionedSpec, iceberg.EntryContentPosDeletes,
+ posDelPaths[i], iceberg.ParquetFile, nil, nil, nil, 1, 128)
+ require.NoError(t, err)
+ bound := map[int][]byte{iceberg.DeleteFilePathFieldID: []byte(paths[target])}
Review Comment:
Would a DV variant of `newAbsorbedDeleteFixture` be worth adding, here or in a follow-up? Both rejection tests send only this file-scoped position delete through `deletesSincePlanning.validate`. DVs are classified in [`newAddedDelete`](https://github.com/apache/iceberg-go/blob/0a280b5f9f3e9939fe74bb60f12fe3268e7582c8/table/conflict_validation.go#L1077-L1100), which is unit-tested only through `validateNoNewDeletesForRewrittenFiles`, not through the pre-check's carry-over loop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#discussion_r4405180160
##########
table/rewrite_data_files.go:
##########
Review Comment:
Updated in 3491bfe: `FailedGroups` now covers batches that failed to commit or were rejected because a delete for one of their files was committed after planning.
##########
table/rewrite_data_files.go:
##########
@@ -625,6 +631,33 @@ func (t *Transaction) rewriteDataFilesPartial(ctx context.Context, groups []Comp
if err != nil {
return result, fmt.Errorf("open table IO for partial rewrite batch: %w", err)
}
+
+ // The groups were planned against the starting table, but an earlier
+ // batch's refresh-and-replay retry can commit on top of peer
+ // snapshots. Those snapshots then form this batch's base, so its
+ // commit-time validator never sees them, while its planned tasks lack
+ // any delete files they added. Rewriting anyway would write the deleted
+ // rows back and then drop those deletes as dead.
+ if err := validateNoNewDeletesSincePlanning(planned, current.Metadata(), t.branch, fs, batchGroups); err != nil {
+ if !errors.Is(err, ErrConflictingDeleteFiles) {
+ return result, fmt.Errorf("validate partial rewrite batch %d against its planning snapshot: %w", batchNum, err)
+ }
+
+ failedCommits++
Review Comment:
Added `TestRewriteDataFiles_PartialProgressRejectedBatchesCountTowardMaxFailedCommits` in 3491bfe: three batches, peer deletes absorbed into batches 2 and 3, `MaxFailedCommits: 1`. It asserts the "maximum failed commits reached" error wrapping `ErrConflictingDeleteFiles`. Replacing the increment with `_ = failedCommits` makes it fail.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "nssalian (via GitHub)" <gi...@apache.org>.
nssalian commented on code in PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#discussion_r4404981007
##########
table/rewrite_data_files.go:
##########
Review Comment:
nit: this still says "groups whose catalog commits failed", but groups rejected by the new pre-check never reach the catalog. Maybe "groups whose batch failed to commit or was rejected because a delete for one of its files was committed after planning"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "zeroshade (via GitHub) via issues" <is...@iceberg.apache.org>.
zeroshade merged PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "nssalian (via GitHub)" <gi...@apache.org>.
nssalian commented on PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#issuecomment-6507608244
Re-checked at 0a280b5. go test ./table/... and golangci-lint come back with no failures. The new caching is covered by the PR's tests: dropping the carried-over deletes fails both rejection tests. Don't have more comments. CC @laskoviymishka
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "nssalian (via GitHub)" <gi...@apache.org>.
nssalian commented on code in PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#discussion_r4404994849
##########
table/rewrite_data_files.go:
##########
@@ -625,6 +631,33 @@ func (t *Transaction) rewriteDataFilesPartial(ctx context.Context, groups []Comp
if err != nil {
return result, fmt.Errorf("open table IO for partial rewrite batch: %w", err)
}
+
+ // The groups were planned against the starting table, but an earlier
+ // batch's refresh-and-replay retry can commit on top of peer
+ // snapshots. Those snapshots then form this batch's base, so its
+ // commit-time validator never sees them, while its planned tasks lack
+ // any delete files they added. Rewriting anyway would write the deleted
+ // rows back and then drop those deletes as dead.
+ if err := validateNoNewDeletesSincePlanning(planned, current.Metadata(), t.branch, fs, batchGroups); err != nil {
+ if !errors.Is(err, ErrConflictingDeleteFiles) {
+ return result, fmt.Errorf("validate partial rewrite batch %d against its planning snapshot: %w", batchNum, err)
+ }
+
+ failedCommits++
Review Comment:
Nothing pins this increment. If I replace it with `_ = failedCommits`, all the `TestRewrite|Compaction` tests still pass. The only `MaxFailedCommits` test goes through `cat.failOn`. Since the doc now says these rejections count toward the bound, could you add a case with `MaxFailedCommits: 1` where two batches get rejected, and assert the "maximum failed commits reached" error?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#issuecomment-6478634671
Thanks @nssalian, and for checking it against base and the three-batch case. Rebased onto main: `AddFiles` is now `AddDataFilesByPath`, and `concurrentTestCatalog` keeps both `restConflicts` and `beforeCommit`. Both nits are addressed in 3491bfe; the absorbed-delete setup is now a shared fixture so the new `MaxFailedCommits` test can reuse it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(table): check partial-progress batches against the planning snapshot [iceberg-go]
Posted by "zeroshade (via GitHub) via issues" <is...@iceberg.apache.org>.
zeroshade commented on code in PR #2302:
URL: https://github.com/apache/iceberg-go/pull/2302#discussion_r4447393229
##########
table/rewrite_data_files_test.go:
##########
@@ -791,6 +791,144 @@ func TestRewriteDataFiles_PartialProgressRetainsSharedPositionDeleteAfterFailure
"generated files from tolerated failed batches must be removed")
}
+// TestRewriteDataFiles_PartialProgressRejectsDeleteAbsorbedByEarlierBatch
+// lands a peer position delete for a batch-2 data file just before batch 1
+// commits. Batch 1's retry rebases onto the peer snapshot without conflict,
+// since the delete targets a file batch 1 does not rewrite. Batch 2's tasks
+// were planned before the delete existed and its transaction starts from
+// batch 1's table, so only a check back to the planning snapshot can stop it
+// from rewriting the file without the delete and then dropping the delete as
+// dead, which would bring the deleted row back.
+func TestRewriteDataFiles_PartialProgressRejectsDeleteAbsorbedByEarlierBatch(t *testing.T) {
+ tbl, cat, groups, posDelPaths := newAbsorbedDeleteFixture(t, 2, 1)
+ posDelPath := posDelPaths[0]
+
+ beforeFiles := parquetFiles(t, tbl.Location())
+ tx := tbl.NewTransaction()
+ result, err := tx.RewriteDataFiles(t.Context(), groups, table.RewriteDataFilesOptions{
+ PartialProgress: true,
+ MaxCommits: 2,
+ })
+ require.NoError(t, err)
+ require.Nil(t, cat.beforeCommit, "the peer commit must have landed during the rewrite")
+
+ require.Len(t, result.CompletedGroups, 1)
+ assert.Equal(t, "absorbed-group-0", result.CompletedGroups[0].PartitionKey)
+ require.Len(t, result.FailedGroups, 1)
+ assert.Equal(t, "absorbed-group-1", result.FailedGroups[0].PartitionKey)
+ assert.ErrorIs(t, result.FailedGroups[0].Err, table.ErrConflictingDeleteFiles)
+ assert.Zero(t, result.RemovedPositionDeleteFiles)
+
+ final, err := cat.LoadTable(t.Context(), tbl.Identifier())
+ require.NoError(t, err)
+ assertRowCount(t, final, 3)
+ finalTasks, err := final.Scan().PlanFiles(t.Context())
+ require.NoError(t, err)
+ var liveDeletes int
+ for _, task := range finalTasks {
+ liveDeletes += len(task.DeleteFiles)
+ }
+ assert.Equal(t, 1, liveDeletes, "the peer's position delete must stay live")
+
+ // The rejected batch is detected before it writes anything.
+ expectedFiles := append([]string{posDelPath}, beforeFiles...)
+ for _, file := range result.CompletedGroups[0].NewDataFiles {
+ expectedFiles = append(expectedFiles, file.FilePath())
+ }
+ assert.ElementsMatch(t, expectedFiles, parquetFiles(t, tbl.Location()),
+ "the rejected batch must not leave compacted outputs behind")
+}
+
+// TestRewriteDataFiles_PartialProgressRejectedBatchesCountTowardMaxFailedCommits
+// rejects two batches through the planning-snapshot check and asserts that
+// they count toward MaxFailedCommits like catalog commit failures do.
+func TestRewriteDataFiles_PartialProgressRejectedBatchesCountTowardMaxFailedCommits(t *testing.T) {
+ tbl, cat, groups, _ := newAbsorbedDeleteFixture(t, 3, 1, 2)
+
+ tx := tbl.NewTransaction()
+ result, err := tx.RewriteDataFiles(t.Context(), groups, table.RewriteDataFilesOptions{
+ PartialProgress: true,
+ MaxCommits: 3,
+ MaxFailedCommits: 1,
+ })
+ require.Nil(t, cat.beforeCommit, "the peer commit must have landed during the rewrite")
+ require.ErrorIs(t, err, table.ErrConflictingDeleteFiles)
+ assert.ErrorContains(t, err, "maximum failed commits reached")
+ require.Len(t, result.CompletedGroups, 1)
+ assert.Equal(t, "absorbed-group-0", result.CompletedGroups[0].PartitionKey)
+ require.Len(t, result.FailedGroups, 2)
+}
+
+// newAbsorbedDeleteFixture writes n two-row data files, each committed on its
+// own, and returns one compaction group per file in path order. Before the
+// rewrite's first catalog commit, a peer commits one file-scoped position
+// delete (row 0) for each data file index in deleteTargets. Index 0's batch
+// commits first, so targets must be greater than 0 to be absorbed by an
+// earlier batch.
+func newAbsorbedDeleteFixture(t *testing.T, n int, deleteTargets ...int) (*table.Table, *concurrentTestCatalog, []table.CompactionTaskGroup, []string) {
+ t.Helper()
+ tbl, cat := newConcurrentRewriteTestTable(t)
+ arrowSc, err := table.SchemaToArrowSchema(tbl.Schema(), nil, false, false)
+ require.NoError(t, err)
+
+ paths := make([]string, n)
+ for i := range paths {
+ paths[i] = tbl.Location() + fmt.Sprintf("/data/absorbed-%d.parquet", i)
+ writeParquetFile(t, paths[i], arrowSc, fmt.Sprintf(
+ `[{"id": %d, "data": "a"}, {"id": %d, "data": "b"}]`, i*2+1, i*2+2))
+
+ tx := tbl.NewTransaction()
+ require.NoError(t, tx.AddDataFilesByPath(t.Context(), []string{paths[i]}, nil, false))
+ tbl, err = tx.Commit(t.Context())
+ require.NoError(t, err)
+ }
+
+ tasks, err := tbl.Scan().PlanFiles(t.Context())
+ require.NoError(t, err)
+ require.Len(t, tasks, n)
+ taskByPath := make(map[string]table.FileScanTask, len(tasks))
+ for _, task := range tasks {
+ taskByPath[task.File.FilePath()] = task
+ }
+ groups := make([]table.CompactionTaskGroup, 0, n)
+ for i, path := range paths {
+ task := taskByPath[path]
+ groups = append(groups, table.CompactionTaskGroup{
+ PartitionKey: fmt.Sprintf("absorbed-group-%d", i),
+ Tasks: []table.FileScanTask{task},
+ TotalSizeBytes: task.File.FileSizeBytes(),
+ })
+ }
+
+ // Equal file_path bounds make each delete file-scoped, so the earlier
+ // batch's validator ignores it.
+ posDelPaths := make([]string, len(deleteTargets))
+ for i, target := range deleteTargets {
+ posDelPaths[i] = tbl.Location() + fmt.Sprintf("/data/absorbed-peer-delete-%d.parquet", target)
+ }
+ cat.beforeCommit = func() {
+ peer, err := cat.LoadTable(t.Context(), tbl.Identifier())
+ require.NoError(t, err)
+ peerTx := peer.NewTransaction()
+ delta := peerTx.NewRowDelta(nil)
+ for i, target := range deleteTargets {
+ writeParquetFile(t, posDelPaths[i], table.PositionalDeleteArrowSchema,
+ fmt.Sprintf(`[{"file_path": "%s", "pos": 0}]`, paths[target]))
+ builder, err := iceberg.NewDataFileBuilder(
+ *iceberg.UnpartitionedSpec, iceberg.EntryContentPosDeletes,
+ posDelPaths[i], iceberg.ParquetFile, nil, nil, nil, 1, 128)
+ require.NoError(t, err)
+ bound := map[int][]byte{iceberg.DeleteFilePathFieldID: []byte(paths[target])}
Review Comment:
Added in 52fe3d0: `TestRewriteDataFiles_PartialProgressRejectsDeleteAbsorbedByEarlierBatch` now runs a `deletion vector` subtest alongside the position-delete one. The fixture takes the delete kind; for DVs it uses a v3 table and writes a real puffin DV with `dv.NewDVWriter`, so the DV goes through `newAddedDelete` and the pre-check carry-over loop. Both subtests fail without the fix and pass with it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org