Skip to content

Commit

Permalink
Add more error message to help debug invalid offset (#1160)
Browse files Browse the repository at this point in the history
Added logSegment info into exception message to help investigate
potential race condition during compaction.
  • Loading branch information
jsjtzyy authored and zzmao committed Apr 29, 2019
1 parent 19f3c2e commit 57fe69b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ private long getAbsolutePositionInLogForOffset(Offset offset,
ConcurrentSkipListMap<Offset, IndexSegment> indexSegments) {
LogSegment logSegment = log.getSegment(offset.getName());
if (logSegment == null || offset.getOffset() > logSegment.getEndOffset()) {
throw new IllegalArgumentException("Offset is invalid: " + offset);
throw new IllegalArgumentException("Offset is invalid: " + offset + "; LogSegment: " + logSegment);
}
int numPrecedingLogSegments = getLogSegmentToIndexSegmentMapping(indexSegments).headMap(offset.getName()).size();
return numPrecedingLogSegments * log.getSegmentCapacity() + offset.getOffset();
Expand Down

0 comments on commit 57fe69b

Please sign in to comment.