MINOR: Fix debug logs to display TimeIndexOffset (#13935)

Reviewers: Luke Chen <showuon@gmail.com>
This commit is contained in:
Divij Vaidya 2023-08-03 11:05:01 +02:00 committed by GitHub
parent d89b26ff44
commit 7d39d7400c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -66,7 +66,7 @@ public class TimeIndex extends AbstractIndex {
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
@ -278,7 +278,7 @@ public class TimeIndex extends AbstractIndex {
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();
}

View File

@ -67,4 +67,11 @@ public class TimestampOffset implements IndexEntry {
result = 31 * result + Long.hashCode(offset);
return result;
}
@Override
public String toString() {
return String.format("TimestampOffset(offset = %d, timestamp = %d)",
offset,
timestamp);
}
}