Skip to content

Commit

Permalink
[core] Fix calculation of lastModifiedCommitIdentifier of writer
Browse files Browse the repository at this point in the history
  • Loading branch information
schnappi17 committed Mar 13, 2024
1 parent 2ecf300 commit 15aa87e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public List<CommitMessage> prepareCommit(boolean waitCompaction, long commitIden
} else {
latestCommittedIdentifier =
snapshotManager
.latestSnapshotOfUser(commitUser)
.latestSnapshotOfUser(commitUser, branchName)
.map(Snapshot::commitIdentifier)
.orElse(Long.MIN_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ private Predicate<Path> nonSnapshotFileFilter() {
}

public Optional<Snapshot> latestSnapshotOfUser(String user) {
Long latestId = latestSnapshotId();
return latestSnapshotOfUser(user, DEFAULT_MAIN_BRANCH);
}

public Optional<Snapshot> latestSnapshotOfUser(String user, String branchName) {
Long latestId = latestSnapshotId(branchName);
if (latestId == null) {
return Optional.empty();
}
Expand All @@ -310,7 +314,7 @@ public Optional<Snapshot> latestSnapshotOfUser(String user) {
"Latest snapshot id is not null, but earliest snapshot id is null. "
+ "This is unexpected.");
for (long id = latestId; id >= earliestId; id--) {
Snapshot snapshot = snapshot(id);
Snapshot snapshot = snapshot(branchName, id);
if (user.equals(snapshot.commitUser())) {
return Optional.of(snapshot);
}
Expand Down

0 comments on commit 15aa87e

Please sign in to comment.