Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,20 @@ public TableMetadata refresh() {
nextMetadataFile = getMetadataFile(ver + 1);
}

this.version = ver;
// only load if the current version is out of date
if (version == null || version != ver) {
this.version = ver;

TableMetadata newMetadata = TableMetadataParser.read(io(), io().newInputFile(metadataFile.toString()));
String newUUID = newMetadata.uuid();
if (currentMetadata != null) {
Preconditions.checkState(newUUID == null || newUUID.equals(currentMetadata.uuid()),
"Table UUID does not match: current=%s != refreshed=%s", currentMetadata.uuid(), newUUID);
}

TableMetadata newMetadata = TableMetadataParser.read(io(), io().newInputFile(metadataFile.toString()));
String newUUID = newMetadata.uuid();
if (currentMetadata != null) {
Preconditions.checkState(newUUID == null || newUUID.equals(currentMetadata.uuid()),
"Table UUID does not match: current=%s != refreshed=%s", currentMetadata.uuid(), newUUID);
this.currentMetadata = newMetadata;
}

this.currentMetadata = newMetadata;
this.shouldRefresh = false;
return currentMetadata;
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private void testRenameWithFileSystem(FileSystem mockFs) throws Exception {
// inject the mockFS into the TableOperations
doReturn(mockFs).when(spyOps).getFileSystem(any(), any());
try {
spyOps.commit(spyOps.current(), meta1);
spyOps.commit(tops.current(), meta1);
fail("Commit should fail due to mock file system");
} catch (CommitFailedException expected) {
}
Expand Down