rdblue commented on a change in pull request #631: Add mechanism to expire old
metadata versions
URL: https://github.com/apache/incubator-iceberg/pull/631#discussion_r346631022
##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -455,13 +516,38 @@ public TableMetadata buildReplacement(Schema
updatedSchema, PartitionSpec update
return new TableMetadata(ops, null, uuid, location,
System.currentTimeMillis(), nextLastColumnId.get(), freshSchema,
specId, builder.build(), ImmutableMap.copyOf(newProperties),
- -1, snapshots, ImmutableList.of());
+ -1, snapshots, ImmutableList.of(), addPreviousMetadata(file,
lastUpdatedMillis, newProperties));
}
public TableMetadata updateLocation(String newLocation) {
return new TableMetadata(ops, null, uuid, newLocation,
System.currentTimeMillis(), lastColumnId, schema, defaultSpecId,
specs, properties,
- currentSnapshotId, snapshots, snapshotLog);
+ currentSnapshotId, snapshots, snapshotLog, addPreviousMetadata(file,
lastUpdatedMillis));
+ }
+
+ private List<MetadataLogEntry> addPreviousMetadata(InputFile previousFile,
long timestampMillis) {
+ return addPreviousMetadata(previousFile, timestampMillis, properties);
+ }
+
+ private List<MetadataLogEntry> addPreviousMetadata(InputFile previousFile,
long timestampMillis,
+ Map<String, String>
updatedProperties) {
+ if (previousFile == null) {
+ return previousMetadata;
+ }
+
+ int maxSize = PropertyUtil.propertyAsInt(updatedProperties,
Review comment:
This should ensure that the property value is at least 1. How about adding
`Math.max(1, ...)`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]