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 @@ -745,7 +745,7 @@ public List<Snapshot> findSnapshotsForIdentifiers(
}

public void commitChangelog(Changelog changelog, long id) throws IOException {
fileIO.writeFile(longLivedChangelogPath(id), changelog.toJson(), false);
fileIO.writeFile(longLivedChangelogPath(id), changelog.toJson(), true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

/** Tests for {@link SnapshotManager}. */
public class SnapshotManagerTest {
Expand Down Expand Up @@ -398,4 +399,15 @@ public void testLongLivedChangelog() throws Exception {
Assertions.assertThat(snapshotManager.latestSnapshotId()).isEqualTo(10);
Assertions.assertThat(snapshotManager.changelog(1)).isNotNull();
}

@Test
public void testCommitChangelogWhenSameChangelogCommitTwice() throws IOException {
FileIO localFileIO = LocalFileIO.create();
SnapshotManager snapshotManager =
new SnapshotManager(localFileIO, new Path(tempDir.toString()));
long id = 1L;
Changelog changelog = createChangelogWithMillis(id, 1L);
snapshotManager.commitChangelog(changelog, id);
assertDoesNotThrow(() -> snapshotManager.commitChangelog(changelog, id));
}
}
Loading