dramaticlly commented on code in PR #14504:
URL: https://github.com/apache/iceberg/pull/14504#discussion_r2505919307
##########
flink/v1.20/flink/src/test/java/org/apache/iceberg/flink/source/TestFlinkMetaDataTable.java:
##########
@@ -626,7 +626,7 @@ public void testMetadataLogEntries() {
metadataLog = metadataLogs.get(2);
assertThat(metadataLog.getField("timestamp"))
- .isEqualTo(Instant.ofEpochMilli(currentSnapshot.timestampMillis()));
+ .isEqualTo(Instant.ofEpochMilli(tableMetadata.lastUpdatedMillis()));
Review Comment:
thanks ryan! I think it's reasonable to assume this will be newer than (or
equal on same millisecond). snapshot timestamp. On top of that, I think is
still valuable to assert it against the tableMetadata lastUpdated millis as
this is part of implementation in
https://github.com/apache/iceberg/blob/8a70fe0ff5f241aec8856f8091c77fdce35ad256/core/src/main/java/org/apache/iceberg/MetadataLogEntriesTable.java#L66.
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1313,17 +1312,14 @@ public Builder setRef(String name, SnapshotRef ref) {
Snapshot snapshot = snapshotsById.get(snapshotId);
ValidationException.check(
snapshot != null, "Cannot set %s to unknown snapshot: %s", name,
snapshotId);
- if (isAddedSnapshot(snapshotId)) {
- this.lastUpdatedMillis = snapshot.timestampMillis();
- }
if (SnapshotRef.MAIN_BRANCH.equals(name)) {
this.currentSnapshotId = ref.snapshotId();
if (lastUpdatedMillis == null) {
this.lastUpdatedMillis = System.currentTimeMillis();
}
- snapshotLog.add(new SnapshotLogEntry(lastUpdatedMillis,
ref.snapshotId()));
+ snapshotLog.add(new SnapshotLogEntry(snapshot.timestampMillis(),
snapshot.snapshotId()));
Review Comment:
Thanks ryan for catching this, rollback to an existing snapshot will not
reuse its creation timestamp in snapshot log entry totally make senses, as the
timestamp in HistoryEntry reflects the time of the change
https://github.com/apache/iceberg/blob/c07f2aabc0a1d02f068ecf1514d2479c0fbdd3b0/api/src/main/java/org/apache/iceberg/HistoryEntry.java#L30-L31
--
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]