You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/05/30 00:29:30 UTC
[GitHub] [iceberg] rdblue opened a new pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
rdblue opened a new pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080
This replaces all calls to Snapshot.manifests with calls to one of 3 new methods:
* `Snapshot.allManifests` returns both delete and data manifests
* `Snapshot.deleteManifests` returns only delete manifests
* `Snapshot.dataManifests` returns only data manifests
Existing references mostly use either `allManifests` or `dataManifests`, depending on the context. For example, tests with assertions for the number of manifests use `allManifests` because the test cases should validate there are no new delete manifests, but other tests that validate rewritten manifests are deleted use `dataManifests` because only data manifests are rewritten and deleted.
This tries to make minimal changes that preserve the current behavior. Operations are not updated to support delete manifests (rewrite still only rewrites data manifests), but will carry through the list of delete manifests correctly.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434005580
##########
File path: core/src/main/java/org/apache/iceberg/AllManifestsTable.java
##########
@@ -136,7 +136,7 @@ protected long targetSplitSize(TableOperations ops) {
} else {
return StaticDataTask.of(
ops.io().newInputFile(ops.current().file().location()),
- snap.manifests(),
+ snap.dataManifests(), // if the manifest list is missing, the table must be v1 and has no delete manifests
Review comment:
This else block is taken when manifests aren't kept in a file and are embedded in table metadata. That's not allowed in v2, so delete manifests and this code path will not happen at the same time.
We could be more explicit and use `allManifests`, so that this fails if a delete manifest is found. That's probably easier to understand and safer.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r433987741
##########
File path: api/src/main/java/org/apache/iceberg/Snapshot.java
##########
@@ -64,13 +64,25 @@
long timestampMillis();
/**
- * Return the location of all manifests in this snapshot.
- * <p>
- * The current table is made of the union of the data files in these manifests.
+ * Return all {@link ManifestFile} instances for either data or delete manifests in this snapshot.
+ *
+ * @return a list of ManifestFile
+ */
+ List<ManifestFile> allManifests();
Review comment:
This seem like a breaking change to the public API. Technically, the old description already assumed a list of all manifests. Do we think it is better to change it now to avoid confusion and misuse?
##########
File path: core/src/main/java/org/apache/iceberg/AllManifestsTable.java
##########
@@ -136,7 +136,7 @@ protected long targetSplitSize(TableOperations ops) {
} else {
return StaticDataTask.of(
ops.io().newInputFile(ops.current().file().location()),
- snap.manifests(),
+ snap.dataManifests(), // if the manifest list is missing, the table must be v1 and has no delete manifests
Review comment:
Shouldn't this table return all manifests?
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434001803
##########
File path: core/src/main/java/org/apache/iceberg/ScanSummary.java
##########
@@ -159,7 +159,7 @@ private void removeTimeFilters(List<Expression> expressions, Expression expressi
removeTimeFilters(filters, Expressions.rewriteNot(scan.filter()));
Expression rowFilter = joinFilters(filters);
- Iterable<ManifestFile> manifests = table.currentSnapshot().manifests();
+ Iterable<ManifestFile> manifests = table.currentSnapshot().dataManifests();
Review comment:
This whole class will need to be updated to support detecting changes in delete files, so I just did the minimum to update it safely. Since it uses `ManifestFiles.read` later instead of `ManifestFiles.readDeletes`, it made sense to only use data manifests. This is one that we should plan to update in a separate PR, if anyone is using 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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434051438
##########
File path: core/src/main/java/org/apache/iceberg/FastAppend.java
##########
@@ -122,6 +122,10 @@ private ManifestFile copyManifest(ManifestFile manifest) {
public List<ManifestFile> apply(TableMetadata base) {
List<ManifestFile> newManifests = Lists.newArrayList();
+ if (base.currentSnapshot() != null) {
+ newManifests.addAll(base.currentSnapshot().deleteManifests());
+ }
Review comment:
Updated to move delete manifests to the end.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434007525
##########
File path: api/src/main/java/org/apache/iceberg/Snapshot.java
##########
@@ -64,13 +64,25 @@
long timestampMillis();
/**
- * Return the location of all manifests in this snapshot.
- * <p>
- * The current table is made of the union of the data files in these manifests.
+ * Return all {@link ManifestFile} instances for either data or delete manifests in this snapshot.
+ *
+ * @return a list of ManifestFile
+ */
+ List<ManifestFile> allManifests();
Review comment:
The question is where we want to make the breaking changes. The format can't be read correctly without support for deletes, so to support v2 we will be making some breaking changes. If we do it with API changes then clients will need to update.
If we just return manifest files for deletes through the old `manifests` method, then older clients will appear to work until they encounter a delete manifest.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#issuecomment-636989621
Thanks for reviewing, @rymurr! Feel free to comment on the places that don't make sense. I might have gotten them wrong. And if not, I'll at least note why I think it should be all or just data.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434131435
##########
File path: core/src/main/java/org/apache/iceberg/BaseSnapshot.java
##########
@@ -120,14 +122,42 @@ public String operation() {
return summary;
}
- @Override
- public List<ManifestFile> manifests() {
- if (manifests == null) {
+ private void cacheManifests() {
Review comment:
I think it would make sense to prevent the race condition later on. I'll submit a PR.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434015210
##########
File path: core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
##########
@@ -174,13 +173,13 @@ private ManifestFile copyManifest(ManifestFile manifest) {
validateFilesCounts();
- // TODO: add sequence numbers here
Iterable<ManifestFile> newManifestsWithMetadata = Iterables.transform(
Iterables.concat(newManifests, addedManifests, rewrittenAddedManifests),
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
// put new manifests at the beginning
- List<ManifestFile> apply = new ArrayList<>();
+ List<ManifestFile> apply = Lists.newArrayList();
+ apply.addAll(base.currentSnapshot().deleteManifests());
Review comment:
To me, putting delete manifests at the end would be more natural.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434047278
##########
File path: core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
##########
@@ -174,13 +173,13 @@ private ManifestFile copyManifest(ManifestFile manifest) {
validateFilesCounts();
- // TODO: add sequence numbers here
Iterable<ManifestFile> newManifestsWithMetadata = Iterables.transform(
Iterables.concat(newManifests, addedManifests, rewrittenAddedManifests),
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
// put new manifests at the beginning
- List<ManifestFile> apply = new ArrayList<>();
+ List<ManifestFile> apply = Lists.newArrayList();
+ apply.addAll(base.currentSnapshot().deleteManifests());
Review comment:
Moving manifests to the end.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r432792366
##########
File path: core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
##########
@@ -297,6 +297,9 @@ private ManifestFile copyManifest(ManifestFile manifest) {
Set<CharSequenceWrapper> deletedFiles = deletedFiles(unmergedManifests);
List<ManifestFile> manifests = Lists.newArrayList();
+ if (current != null) {
+ manifests.addAll(current.deleteManifests());
+ }
Review comment:
Carry forward delete manifests, if present.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#issuecomment-636246798
@prodeezy, @rymurr, here's another row-level delete PR.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434000639
##########
File path: core/src/test/java/org/apache/iceberg/TableTestBase.java
##########
@@ -224,10 +224,10 @@ void validateSnapshot(Snapshot old, Snapshot snap, long sequenceNumber, DataFile
}
void validateSnapshot(Snapshot old, Snapshot snap, Long sequenceNumber, DataFile... newFiles) {
- List<ManifestFile> oldManifests = old != null ? old.manifests() : ImmutableList.of();
+ List<ManifestFile> oldManifests = old != null ? old.dataManifests() : ImmutableList.of();
Review comment:
My reasoning was that the signature of this method is `DataFile... newFiles`, so callers can't pass `DeleteFile`. But, I could add an assertion that `deleteManifests()` is empty.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434002396
##########
File path: core/src/main/java/org/apache/iceberg/FastAppend.java
##########
@@ -122,6 +122,10 @@ private ManifestFile copyManifest(ManifestFile manifest) {
public List<ManifestFile> apply(TableMetadata base) {
List<ManifestFile> newManifests = Lists.newArrayList();
+ if (base.currentSnapshot() != null) {
+ newManifests.addAll(base.currentSnapshot().deleteManifests());
+ }
Review comment:
Yes, the idea is to keep delete manifests at the front of the list.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi merged pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi merged pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r432792190
##########
File path: core/src/main/java/org/apache/iceberg/IncrementalDataTableScan.java
##########
@@ -84,7 +84,7 @@ public TableScan appendsAfter(long newFromSnapshotId) {
Set<Long> snapshotIds = Sets.newHashSet(Iterables.transform(snapshots, Snapshot::snapshotId));
Set<ManifestFile> manifests = FluentIterable
.from(snapshots)
- .transformAndConcat(s -> s.manifests())
+ .transformAndConcat(s -> s.dataManifests())
Review comment:
For now, scans continue to ignore delete manifests and delete files.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434054474
##########
File path: core/src/test/java/org/apache/iceberg/TableTestBase.java
##########
@@ -224,10 +224,10 @@ void validateSnapshot(Snapshot old, Snapshot snap, long sequenceNumber, DataFile
}
void validateSnapshot(Snapshot old, Snapshot snap, Long sequenceNumber, DataFile... newFiles) {
- List<ManifestFile> oldManifests = old != null ? old.manifests() : ImmutableList.of();
+ List<ManifestFile> oldManifests = old != null ? old.dataManifests() : ImmutableList.of();
Review comment:
Adding an assertion that the set of delete manifests has not changed from old to new.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rymurr commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rymurr commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r433760536
##########
File path: core/src/main/java/org/apache/iceberg/AllManifestsTable.java
##########
@@ -136,7 +136,7 @@ protected long targetSplitSize(TableOperations ops) {
} else {
return StaticDataTask.of(
ops.io().newInputFile(ops.current().file().location()),
- snap.manifests(),
+ snap.dataManifests(), // if the manifest list is missing, the table must be v1 and has no delete manifests
Review comment:
I am not sure I understand the comment here or why `dataManifests` is used instead of `allManifests`
##########
File path: core/src/test/java/org/apache/iceberg/TableTestBase.java
##########
@@ -224,10 +224,10 @@ void validateSnapshot(Snapshot old, Snapshot snap, long sequenceNumber, DataFile
}
void validateSnapshot(Snapshot old, Snapshot snap, Long sequenceNumber, DataFile... newFiles) {
- List<ManifestFile> oldManifests = old != null ? old.manifests() : ImmutableList.of();
+ List<ManifestFile> oldManifests = old != null ? old.dataManifests() : ImmutableList.of();
Review comment:
This and two other tests use `dataManifests()` where all other tests have been changed to `allManifests()`. Is this intentional?
Other tests:
`TestRemoveSnapshots`
`RewriteManifestsAction`
##########
File path: core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
##########
@@ -174,13 +173,13 @@ private ManifestFile copyManifest(ManifestFile manifest) {
validateFilesCounts();
- // TODO: add sequence numbers here
Iterable<ManifestFile> newManifestsWithMetadata = Iterables.transform(
Iterables.concat(newManifests, addedManifests, rewrittenAddedManifests),
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
// put new manifests at the beginning
- List<ManifestFile> apply = new ArrayList<>();
+ List<ManifestFile> apply = Lists.newArrayList();
+ apply.addAll(base.currentSnapshot().deleteManifests());
Review comment:
Here data manifests are (potentially) rewritten while keeping deletes the same. Again with deletes at the front. Do I understand correctly? The comment is a bit misleading as immediately below it old delete manifests are added to the list.
##########
File path: core/src/main/java/org/apache/iceberg/FastAppend.java
##########
@@ -122,6 +122,10 @@ private ManifestFile copyManifest(ManifestFile manifest) {
public List<ManifestFile> apply(TableMetadata base) {
List<ManifestFile> newManifests = Lists.newArrayList();
+ if (base.currentSnapshot() != null) {
+ newManifests.addAll(base.currentSnapshot().deleteManifests());
+ }
Review comment:
The addition of delete files in `newManifests` far above the addition of data files threw me a bit. Is it intentional to ensure the delete files are at the front of the list?
##########
File path: core/src/main/java/org/apache/iceberg/ScanSummary.java
##########
@@ -159,7 +159,7 @@ private void removeTimeFilters(List<Expression> expressions, Expression expressi
removeTimeFilters(filters, Expressions.rewriteNot(scan.filter()));
Expression rowFilter = joinFilters(filters);
- Iterable<ManifestFile> manifests = table.currentSnapshot().manifests();
+ Iterable<ManifestFile> manifests = table.currentSnapshot().dataManifests();
Review comment:
Is this explicitly ignoring the effect of deleted rows on partition metrics or is it just that you are short circuiting any delete files (as we can't use them anyways)
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r432791830
##########
File path: core/src/main/java/org/apache/iceberg/FileHistory.java
##########
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iceberg;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-import org.apache.iceberg.exceptions.RuntimeIOException;
-import org.apache.iceberg.expressions.Literal;
-import org.apache.iceberg.io.CloseableIterable;
-import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
-import org.apache.iceberg.relocated.com.google.common.collect.Iterables;
-import org.apache.iceberg.relocated.com.google.common.collect.Lists;
-import org.apache.iceberg.relocated.com.google.common.collect.Sets;
-import org.apache.iceberg.types.Types;
-import org.apache.iceberg.util.CharSequenceWrapper;
-
-public class FileHistory {
Review comment:
This is no longer needed. It was used to find all manifest entries for a file to help debug changes. Now that can be handled in parallel by the `all_entries` metadata table.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434011259
##########
File path: core/src/test/java/org/apache/iceberg/TableTestBase.java
##########
@@ -224,10 +224,10 @@ void validateSnapshot(Snapshot old, Snapshot snap, long sequenceNumber, DataFile
}
void validateSnapshot(Snapshot old, Snapshot snap, Long sequenceNumber, DataFile... newFiles) {
- List<ManifestFile> oldManifests = old != null ? old.manifests() : ImmutableList.of();
+ List<ManifestFile> oldManifests = old != null ? old.dataManifests() : ImmutableList.of();
Review comment:
I think adding an assertion is a good idea. Will it keep it safe for future use.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r432792134
##########
File path: core/src/main/java/org/apache/iceberg/FindFiles.java
##########
@@ -197,7 +197,7 @@ public Builder inPartitions(PartitionSpec spec, List<StructLike> partitions) {
}
// when snapshot is not null
- CloseableIterable<ManifestEntry<DataFile>> entries = new ManifestGroup(ops.io(), snapshot.manifests())
+ CloseableIterable<ManifestEntry<DataFile>> entries = new ManifestGroup(ops.io(), snapshot.dataManifests())
Review comment:
The contract for this class is to return matching data files, not splits. We use it in some cases to avoid `newScan` that will return either `FileScanTask` or `CombinedScanTask` and will emit a scan event. I think we may be able to remove it, or update it to return both data and delete files. For now, this uses `dataManifests` to mimic the current behavior.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434006671
##########
File path: core/src/main/java/org/apache/iceberg/BaseSnapshot.java
##########
@@ -120,14 +122,42 @@ public String operation() {
return summary;
}
- @Override
- public List<ManifestFile> manifests() {
- if (manifests == null) {
+ private void cacheManifests() {
+ if (allManifests == null) {
// if manifests isn't set, then the snapshotFile is set and should be read to get the list
- this.manifests = ManifestLists.read(manifestList);
+ this.allManifests = ManifestLists.read(manifestList);
+ }
+
+ if (dataManifests == null) {
+ this.dataManifests = ImmutableList.copyOf(Iterables.filter(allManifests,
Review comment:
The list of manifests can contain 1-2k entries, will iterating through that list twice here have an impact on performance?
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#issuecomment-637770327
Thanks for the change, @rdblue! Thanks for reviewing, @rymurr!
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434046595
##########
File path: core/src/main/java/org/apache/iceberg/AllManifestsTable.java
##########
@@ -136,7 +136,7 @@ protected long targetSplitSize(TableOperations ops) {
} else {
return StaticDataTask.of(
ops.io().newInputFile(ops.current().file().location()),
- snap.manifests(),
+ snap.dataManifests(), // if the manifest list is missing, the table must be v1 and has no delete manifests
Review comment:
Updated to use `allManifests`.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434052930
##########
File path: core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
##########
@@ -297,6 +297,9 @@ private ManifestFile copyManifest(ManifestFile manifest) {
Set<CharSequenceWrapper> deletedFiles = deletedFiles(unmergedManifests);
List<ManifestFile> manifests = Lists.newArrayList();
+ if (current != null) {
+ manifests.addAll(current.deleteManifests());
+ }
Review comment:
Moved to the end of the manifest list.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434008506
##########
File path: core/src/main/java/org/apache/iceberg/BaseSnapshot.java
##########
@@ -120,14 +122,42 @@ public String operation() {
return summary;
}
- @Override
- public List<ManifestFile> manifests() {
- if (manifests == null) {
+ private void cacheManifests() {
Review comment:
Do we have to reason about thread safety like we do in `PartitionSpec`, for example?
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434004579
##########
File path: core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
##########
@@ -174,13 +173,13 @@ private ManifestFile copyManifest(ManifestFile manifest) {
validateFilesCounts();
- // TODO: add sequence numbers here
Iterable<ManifestFile> newManifestsWithMetadata = Iterables.transform(
Iterables.concat(newManifests, addedManifests, rewrittenAddedManifests),
manifest -> GenericManifestFile.copyOf(manifest).withSnapshotId(snapshotId()).build());
// put new manifests at the beginning
- List<ManifestFile> apply = new ArrayList<>();
+ List<ManifestFile> apply = Lists.newArrayList();
+ apply.addAll(base.currentSnapshot().deleteManifests());
Review comment:
We should probably update the comment to include delete handling. We put new manifests at the front of the list because those are the ones most likely to have data for a query when writes align with reads (recent hours are read more often than data that's months old).
I guess we don't really need the delete manifests at the start of the list. We could put those at the end since they get split out into a separate list. The one that matters is scanning the recent manifests first when planning jobs to get data faster in engines like Presto that run the query and planning concurrently.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434007987
##########
File path: core/src/main/java/org/apache/iceberg/BaseSnapshot.java
##########
@@ -120,14 +122,42 @@ public String operation() {
return summary;
}
- @Override
- public List<ManifestFile> manifests() {
- if (manifests == null) {
+ private void cacheManifests() {
+ if (allManifests == null) {
// if manifests isn't set, then the snapshotFile is set and should be read to get the list
- this.manifests = ManifestLists.read(manifestList);
+ this.allManifests = ManifestLists.read(manifestList);
+ }
+
+ if (dataManifests == null) {
+ this.dataManifests = ImmutableList.copyOf(Iterables.filter(allManifests,
Review comment:
No, this would be pretty quick.
----------------------------------------------------------------
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.
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
[GitHub] [iceberg] rdblue commented on a change in pull request #1080: Split Snapshot.manifests into dataManifests and deleteManifests
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1080:
URL: https://github.com/apache/iceberg/pull/1080#discussion_r434051120
##########
File path: core/src/main/java/org/apache/iceberg/BaseSnapshot.java
##########
@@ -120,14 +122,42 @@ public String operation() {
return summary;
}
- @Override
- public List<ManifestFile> manifests() {
- if (manifests == null) {
+ private void cacheManifests() {
Review comment:
No. The main problem in #219 was that the lazy value was set before it was completely initialized. Here, `allManifests` is set to a list that will not change.
In that PR, we also added double checking and a lock to prevent two threads from building the same value. We could do that here as well, but it doesn't affect correctness. There is just a race condition to produce the same sets of manifests.
----------------------------------------------------------------
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.
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