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 @@ -87,12 +87,50 @@ private void rangeCheck(long nextSnapshotId) {
nextSnapshotId);
} else {
if (!changelogDecoupled) {
long earliestTime = -1;
long latestTime = -1;

if (earliestSnapshotId != null) {
try {
if (snapshotManager.snapshotExists(earliestSnapshotId)) {
earliestTime =
snapshotManager.snapshot(earliestSnapshotId).timeMillis();
}
} catch (Exception e) {
LOG.warn(
"Failed to get snapshot time for ID earliest: {}",
earliestSnapshotId,
e);
}
}

if (latestSnapshotId != null) {
try {
if (snapshotManager.snapshotExists(latestSnapshotId)) {
latestTime = snapshotManager.snapshot(latestSnapshotId).timeMillis();
}
} catch (Exception e) {
LOG.warn(
"Failed to get snapshot time for ID latest: {}",
latestSnapshotId,
e);
}
}

throw new OutOfRangeException(
String.format(
"The snapshot with id %d has expired. You can: "
+ "1. increase the snapshot or changelog expiration time. "
"The wanted read snapshot with id %d has expired.\n"
+ "Current status:\n"
+ " Earliest Snapshot ID: %s, Time: %d\n"
+ " Latest Snapshot ID: %s, Time: %d\n"
+ "You can: \n"
+ "1. increase the snapshot or changelog expiration time. \n"
+ "2. use consumer-id to ensure that unconsumed snapshots will not be expired.",
nextSnapshotId));
nextSnapshotId,
earliestSnapshotId,
earliestTime,
latestSnapshotId == null ? "N/A" : latestSnapshotId,
latestTime));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,10 @@ public void testConsumeId() throws Exception {
})
.satisfies(
anyCauseMatches(
OutOfRangeException.class, "The snapshot with id 5 has expired."));
OutOfRangeException.class,
"The wanted read snapshot with id 5 has expired."))
.hasMessageContaining("Earliest Snapshot ID:")
.hasMessageContaining("Latest Snapshot ID:");

write.close();
commit.close();
Expand Down
Loading