-
Notifications
You must be signed in to change notification settings - Fork 0
Fix remaining issues with snapshot expiration for branching and tagging #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -415,12 +415,15 @@ static TableMetadata fromJson(FileIO io, String metadataLocation, JsonNode node) | |
|
|
||
| // parse properties map | ||
| Map<String, String> properties = JsonUtil.getStringMap(PROPERTIES, node); | ||
| long currentVersionId = JsonUtil.getLong(CURRENT_SNAPSHOT_ID, node); | ||
| long currentSnapshotId = JsonUtil.getLong(CURRENT_SNAPSHOT_ID, node); | ||
| long lastUpdatedMillis = JsonUtil.getLong(LAST_UPDATED_MILLIS, node); | ||
|
|
||
| Map<String, SnapshotRef> refs; | ||
| if (node.has(REFS)) { | ||
| refs = refsFromJson(node.get(REFS)); | ||
| } else if (currentSnapshotId != -1) { | ||
| // initialize the main branch if there are no refs | ||
| refs = ImmutableMap.of(SnapshotRef.MAIN_BRANCH, SnapshotRef.branchBuilder(currentSnapshotId).build()); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it's not directly related to the expiration logic, but Is initializing the main branch when parsing sufficient for setting the main ref on the next commit? I was thinking it would have to be set in the builder.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should follow up with a more thorough fix, but this is a good start. |
||
| } else { | ||
| refs = ImmutableMap.of(); | ||
| } | ||
|
|
@@ -457,7 +460,7 @@ static TableMetadata fromJson(FileIO io, String metadataLocation, JsonNode node) | |
|
|
||
| return new TableMetadata(metadataLocation, formatVersion, uuid, location, | ||
| lastSequenceNumber, lastUpdatedMillis, lastAssignedColumnId, currentSchemaId, schemas, defaultSpecId, specs, | ||
| lastAssignedPartitionId, defaultSortOrderId, sortOrders, properties, currentVersionId, | ||
| lastAssignedPartitionId, defaultSortOrderId, sortOrders, properties, currentSnapshotId, | ||
| snapshots, entries.build(), metadataEntries.build(), refs, | ||
| ImmutableList.of() /* no changes from the file */); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this works too, I built the complex map before hand so that the ancestors didn't need to be traversed again and could be maintained in memory for the later computation, but maybe that's a overkill (and also consumes even more memory)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't that expensive. We could also pass a set into the branch logic to update, but that would require changes there and would use an input variable as output, so I'd prefer not to.