Skip to content
Open
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 @@ -195,10 +195,11 @@ public void fastForward(String branchName) {
schemaManager.copyWithBranch(branchName).schemaDirectory(),
schemaManager.schemaDirectory(),
true);
fileIO.copyFiles(
tagManager.copyWithBranch(branchName).tagDirectory(),
tagManager.tagDirectory(),
true);
// Continue fast-forward even without tags.
Path branchTagDirectory = tagManager.copyWithBranch(branchName).tagDirectory();
if (fileIO.exists(branchTagDirectory)) {
fileIO.copyFiles(branchTagDirectory, tagManager.tagDirectory(), true);
}
snapshotManager.invalidateCache();
} catch (IOException e) {
throw new RuntimeException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,35 @@ public void testFastForward() throws Exception {
"4|40|400|binary|varbinary|mapKey:mapVal|multiset");
}

@Test
public void testFastForwardWithoutTag() throws Exception {
FileStoreTable table = createFileStoreTable();

try (StreamTableWrite write = table.newWrite(commitUser);
StreamTableCommit commit = table.newCommit(commitUser)) {
write.write(rowData(0, 0, 0L));
commit.commit(0, write.prepareCommit(false, 1));
}

table.createBranch(BRANCH_NAME);
FileStoreTable tableBranch = createBranchTable(BRANCH_NAME);

try (StreamTableWrite write = tableBranch.newWrite(commitUser);
StreamTableCommit commit = tableBranch.newCommit(commitUser)) {
write.write(rowData(2, 20, 200L));
commit.commit(1, write.prepareCommit(false, 2));
}

table.fastForward(BRANCH_NAME);

assertThat(
getResult(
table.newRead(),
toSplits(table.newSnapshotReader().read().dataSplits()),
BATCH_ROW_TO_STRING))
.contains("2|20|200|binary|varbinary|mapKey:mapVal|multiset");
}

@Test
public void testUnsupportedTagName() throws Exception {
FileStoreTable table = createFileStoreTable();
Expand Down