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 @@ -255,7 +255,15 @@ public List<ManifestCommittable> filterCommitted(List<ManifestCommittable> commi
"Committables must be sorted according to identifiers before filtering. This is unexpected.");
}

Optional<Snapshot> latestSnapshot = snapshotManager.latestSnapshotOfUser(commitUser);
Optional<Snapshot> latestSnapshot =
options.commitStrictModeLastSafeSnapshot()
.map(
id ->
snapshotManager.latestSnapshotOfUser(
commitUser,
snapshotManager.latestSnapshotId(),
id + 1))
.orElse(snapshotManager.latestSnapshotOfUser(commitUser));
if (latestSnapshot.isPresent()) {
List<ManifestCommittable> result = new ArrayList<>();
for (ManifestCommittable committable : committables) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,23 +587,26 @@ private static void collectSnapshots(Consumer<Path> pathConsumer, List<Path> pat
}

public Optional<Snapshot> latestSnapshotOfUser(String user) {
return latestSnapshotOfUser(user, latestSnapshotId());
return latestSnapshotOfUser(user, latestSnapshotId(), null);
}

public Optional<Snapshot> latestSnapshotOfUserFromFilesystem(String user) {
return latestSnapshotOfUser(user, latestSnapshotIdFromFileSystem());
return latestSnapshotOfUser(user, latestSnapshotIdFromFileSystem(), null);
}

private Optional<Snapshot> latestSnapshotOfUser(String user, Long latestId) {
public Optional<Snapshot> latestSnapshotOfUser(
String user, Long latestId, @Nullable Long earliestId) {
if (latestId == null) {
return Optional.empty();
}
if (earliestId == null) {
earliestId =
Preconditions.checkNotNull(
earliestSnapshotId(),
"Latest snapshot id is not null, but earliest snapshot id is null. "
+ "This is unexpected.");
}

long earliestId =
Preconditions.checkNotNull(
earliestSnapshotId(),
"Latest snapshot id is not null, but earliest snapshot id is null. "
+ "This is unexpected.");
for (long id = latestId; id >= earliestId; id--) {
Snapshot snapshot;
try {
Expand Down
Loading