Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create another index file for each log segment with name SegmentBaseOffset.time.index. The granularity density of the index is defined by time.index.interval.ms and index.interval.bytes configuration.

The time index entry format is:

...

  1. When broker receives a message, if the message is not rejected due to timestamp exceeds threshold, the message will be appended to the log. 
  2. The timestamp will either be LogAppendTime or CreateTime depending on the configuration.
  3. We will insert a time index entry in the following scenarios:
    1. If (the_largest_message
    timestamp falls into a new
    1. _timestamp_ever_seen - the_timestamp_of_the_last_time_index_entry) >= time.index.interval.ms
    bucket which is greater than the previous appended index entry, the broker appends a new time index entry to the time index with the new time.index.interval.ms bucket timestamp.
    1.  AND the broker has appended more than index.interval.bytes since last time index entry insertion.
    2. When a log segment is closed, if the message with largest timestamp is in this closed segment, the broker will insert a time index entry to the time index. The time index entry points to that message with largest timestamp.
    3. When a new log segment is created, the broker will insert a time index entry to the time index of the new log segment when appending the first message whose timestamp
    falls into a new time.index.interval.ms bucket is appended to the log segment. 
    1. is greater than the timestamp of last time index entry.
  4. It is possible that a log segment does not have any time index entry if all the messages has smaller timestamp than the previous log segments. In that case the time based index would be empty.
  5. The default initial / max size of the time index files is the same as offset index files.
  6. If all the messages in a log segment have message.format.version before 0.10.0, broker will insert a time index entry (last_modification_time_of_the_segment -> offset_of_the_last_message_in_the_segment) to the time index.

...