amogh-jahagirdar commented on code in PR #4071:
URL: https://github.com/apache/iceberg/pull/4071#discussion_r846855285
##########
core/src/main/java/org/apache/iceberg/MetadataUpdate.java:
##########
@@ -227,31 +228,60 @@ public String name() {
@Override
public void applyTo(TableMetadata.Builder metadataBuilder) {
- // TODO: this should be generalized when tagging is supported
- metadataBuilder.removeBranch(name);
+ metadataBuilder.removeRef(name);
}
}
class SetSnapshotRef implements MetadataUpdate {
private final String name;
- private final long snapshotId;
-
- public SetSnapshotRef(String name, long snapshotId) {
+ private final Long snapshotId;
+ private final SnapshotRefType type;
+ private Integer minSnapshotsToKeep;
+ private Long maxSnapshotAgeMs;
+ private Long maxRefAgeMs;
+
+ public SetSnapshotRef(String name, Long snapshotId, SnapshotRefType type,
Integer minSnapshotsToKeep,
+ Long maxSnapshotAgeMs, Long maxRefAgeMs) {
this.name = name;
this.snapshotId = snapshotId;
+ this.type = type;
+ this.minSnapshotsToKeep = minSnapshotsToKeep;
+ this.maxSnapshotAgeMs = maxSnapshotAgeMs;
+ this.maxRefAgeMs = maxRefAgeMs;
}
public String name() {
return name;
}
+ public String type() {
+ return type.name().toLowerCase(Locale.ROOT);
+ }
+
public long snapshotId() {
return snapshotId;
}
+ public Integer minSnapshotsToKeep() {
+ return minSnapshotsToKeep;
+ }
+
+ public Long maxSnapshotAgeMs() {
+ return maxSnapshotAgeMs;
+ }
+
+ public Long maxRefAgeMs() {
+ return maxRefAgeMs;
+ }
+
@Override
public void applyTo(TableMetadata.Builder metadataBuilder) {
- metadataBuilder.setBranchSnapshot(snapshotId, name);
+ SnapshotRef ref = SnapshotRef.builderFor(snapshotId, type)
+ .minSnapshotsToKeep(minSnapshotsToKeep)
+ .maxSnapshotAgeMs(maxSnapshotAgeMs)
+ .maxRefAgeMs(maxRefAgeMs)
+ .build();
+ metadataBuilder.setRef(name, ref);
Review Comment:
@rdblue So now we will be just doing a setRef and properly passing through
possibly updated retention properties, so that Metadata is properly updated.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]