Skip to content

Commit

Permalink
MINOR: Fix debug logs to display TimeIndexOffset (apache#13935)
Browse files Browse the repository at this point in the history
Reviewers: Luke Chen <[email protected]>
  • Loading branch information
divijvaidya authored Aug 3, 2023
1 parent d89b26f commit 7d39d74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public TimeIndex(File file, long baseOffset, int maxIndexSize, boolean writable)
this.lastEntry = lastEntryFromIndexFile();

log.debug("Loaded index file {} with maxEntries = {}, maxIndexSize = {}, entries = {}, lastOffset = {}, file position = {}",
file.getAbsolutePath(), maxEntries(), maxIndexSize, entries(), lastEntry, mmap().position());
file.getAbsolutePath(), maxEntries(), maxIndexSize, entries(), lastEntry.offset, mmap().position());
}

@Override
Expand Down Expand Up @@ -278,7 +278,7 @@ private void truncateToEntries(int entries) {
super.truncateToEntries0(entries);
this.lastEntry = lastEntryFromIndexFile();
log.debug("Truncated index {} to {} entries; position is now {} and last entry is now {}",
file().getAbsolutePath(), entries, mmap().position(), lastEntry);
file().getAbsolutePath(), entries, mmap().position(), lastEntry.offset);
} finally {
lock.unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ public int hashCode() {
result = 31 * result + Long.hashCode(offset);
return result;
}

@Override
public String toString() {
return String.format("TimestampOffset(offset = %d, timestamp = %d)",
offset,
timestamp);
}
}

0 comments on commit 7d39d74

Please sign in to comment.