mirror of https://github.com/apache/kafka.git
MINOR: Fix debug logs to display TimeIndexOffset (#13935)
Reviewers: Luke Chen <showuon@gmail.com>
This commit is contained in:
parent
d89b26ff44
commit
7d39d7400c
|
@ -66,7 +66,7 @@ public class TimeIndex extends AbstractIndex {
|
||||||
this.lastEntry = lastEntryFromIndexFile();
|
this.lastEntry = lastEntryFromIndexFile();
|
||||||
|
|
||||||
log.debug("Loaded index file {} with maxEntries = {}, maxIndexSize = {}, entries = {}, lastOffset = {}, file position = {}",
|
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
|
@Override
|
||||||
|
@ -278,7 +278,7 @@ public class TimeIndex extends AbstractIndex {
|
||||||
super.truncateToEntries0(entries);
|
super.truncateToEntries0(entries);
|
||||||
this.lastEntry = lastEntryFromIndexFile();
|
this.lastEntry = lastEntryFromIndexFile();
|
||||||
log.debug("Truncated index {} to {} entries; position is now {} and last entry is now {}",
|
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 {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,4 +67,11 @@ public class TimestampOffset implements IndexEntry {
|
||||||
result = 31 * result + Long.hashCode(offset);
|
result = 31 * result + Long.hashCode(offset);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("TimestampOffset(offset = %d, timestamp = %d)",
|
||||||
|
offset,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue