TimeIndex — Index Of Timestamp And Offsets Of Log Segment

TimeIndex is an index of the timestamps and the offsets of a LogSegment.

TimeIndex uses entrySize of 12 bytes (12-byte time index entries).

TimeIndex is created when:

Tip

Enable ALL logging level for kafka.log.TimeIndex logger to see what happens inside.

Add the following line to config/log4j.properties:

log4j.logger.kafka.log.TimeIndex=ALL

Refer to Logging.

Creating TimeIndex Instance

TimeIndex takes the following to be created:

  • Underlying File

  • Base offset

  • maxIndexSize (default: -1)

  • writable flag (default: true)

TimeIndex initializes the internal properties.

While being created, TimeIndex prints out the following DEBUG message to the logs:

Loaded index file [absolutePath] with maxEntries = [maxEntries], maxIndexSize = [maxIndexSize], entries = [_entries], lastOffset = [_lastOffset], file position = [position]

lookup Method

lookup(
  targetTimestamp: Long): TimestampOffset

lookup…​FIXME

Note
lookup is used when…​FIXME

truncateTo Method

truncateTo(
  offset: Long): Unit
Note
truncateTo is part of the AbstractIndex Contract to…​FIXME.

truncateTo…​FIXME

lastEntryFromIndexFile Internal Method

lastEntryFromIndexFile: TimestampOffset

lastEntryFromIndexFile…​FIXME

Note
lastEntryFromIndexFile is used when…​FIXME

Internal Properties

Name Description

_lastEntry

Used when…​FIXME

results matching ""

    No results matching ""