Class

kafka.log

LogSegment

Related Doc: package log

Permalink

class LogSegment extends Logging

A segment of the log. Each segment has two components: a log and an index. The log is a FileMessageSet containing the actual messages. The index is an OffsetIndex that maps from logical offsets to physical file positions. Each segment has a base offset which is an offset <= the least offset of any message in this segment and > any offset in any previous segment.

A segment with a base offset of [base_offset] would be stored in two files, a [base_offset].index and a [base_offset].log file.

Annotations
@nonthreadsafe()
Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LogSegment
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LogSegment(dir: File, startOffset: Long, indexIntervalBytes: Int, maxIndexSize: Int, rollJitterMs: Long, time: Time, fileAlreadyExists: Boolean = false, initFileSize: Int = 0, preallocate: Boolean = false)

    Permalink
  2. new LogSegment(log: FileMessageSet, index: OffsetIndex, baseOffset: Long, indexIntervalBytes: Int, rollJitterMs: Long, time: Time)

    Permalink

    log

    The message set containing log entries

    index

    The offset index

    baseOffset

    A lower bound on the offsets in this segment

    indexIntervalBytes

    The approximate number of bytes between entries in the index

    time

    The time instance

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def append(offset: Long, messages: ByteBufferMessageSet): Unit

    Permalink

    Append the given messages starting with the given offset.

    Append the given messages starting with the given offset. Add an entry to the index if needed.

    It is assumed this method is being called from within a lock.

    offset

    The first offset in the message set.

    messages

    The messages to append.

    Annotations
    @nonthreadsafe()
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val baseOffset: Long

    Permalink

    A lower bound on the offsets in this segment

  7. def changeFileSuffixes(oldSuffix: String, newSuffix: String): Unit

    Permalink

    Change the suffix for the index and log file for this log segment

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def close(): Unit

    Permalink

    Close this log segment

  10. var created: Long

    Permalink
  11. def debug(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  12. def debug(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  13. def debug(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  14. def delete(): Unit

    Permalink

    Delete this log segment from the filesystem.

    Delete this log segment from the filesystem.

    Exceptions thrown

    KafkaStorageException if the delete fails.

  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def error(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  18. def error(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  19. def error(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  20. def fatal(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  21. def fatal(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  22. def fatal(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  23. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. def flush(): Unit

    Permalink

    Flush this log segment to disk

    Flush this log segment to disk

    Annotations
    @threadsafe()
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  27. val index: OffsetIndex

    Permalink

    The offset index

  28. val indexIntervalBytes: Int

    Permalink

    The approximate number of bytes between entries in the index

  29. def info(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  30. def info(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  31. def info(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def lastModified: Long

    Permalink

    The last modified time of this log segment as a unix time stamp

  34. def lastModified_=(ms: Long): Boolean

    Permalink

    Change the last modified time for this log segment

  35. val log: FileMessageSet

    Permalink

    The message set containing log entries

  36. var logIdent: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  37. lazy val logger: Logger

    Permalink
    Definition Classes
    Logging
  38. val loggerName: String

    Permalink
    Definition Classes
    Logging
  39. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  40. def nextOffset(): Long

    Permalink

    Calculate the offset that would be used for the next message to be append to this segment.

    Calculate the offset that would be used for the next message to be append to this segment. Note that this is expensive.

    Annotations
    @threadsafe()
  41. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  42. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. def read(startOffset: Long, maxOffset: Option[Long], maxSize: Int, maxPosition: Long = size): FetchDataInfo

    Permalink

    Read a message set from this segment beginning with the first offset >= startOffset.

    Read a message set from this segment beginning with the first offset >= startOffset. The message set will include no more than maxSize bytes and will end before maxOffset if a maxOffset is specified.

    startOffset

    A lower bound on the first offset to include in the message set we read

    maxOffset

    An optional maximum offset for the message set we read

    maxSize

    The maximum number of bytes to include in the message set we read

    maxPosition

    An optional maximum position in the log segment that should be exposed for read.

    returns

    The fetched data and the offset metadata of the first message whose offset is >= startOffset, or null if the startOffset is larger than the largest offset in this log

    Annotations
    @threadsafe()
  44. def recover(maxMessageSize: Int): Int

    Permalink

    Run recovery on the given segment.

    Run recovery on the given segment. This will rebuild the index from the log file and lop off any invalid bytes from the end of the log and index.

    maxMessageSize

    A bound the memory allocation in the case of a corrupt message size--we will assume any message larger than this is corrupt.

    returns

    The number of bytes truncated from the log

    Annotations
    @nonthreadsafe()
  45. val rollJitterMs: Long

    Permalink
  46. def size: Long

    Permalink
  47. def swallow(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  48. def swallowDebug(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  49. def swallowError(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  50. def swallowInfo(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  51. def swallowTrace(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  52. def swallowWarn(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  53. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  54. def toString(): String

    Permalink
    Definition Classes
    LogSegment → AnyRef → Any
  55. def trace(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  56. def trace(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  57. def trace(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  58. def truncateTo(offset: Long): Int

    Permalink

    Truncate off all index and log entries with offsets >= the given offset.

    Truncate off all index and log entries with offsets >= the given offset. If the given offset is larger than the largest message in this segment, do nothing.

    offset

    The offset to truncate to

    returns

    The number of log bytes truncated

    Annotations
    @nonthreadsafe()
  59. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  62. def warn(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  63. def warn(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  64. def warn(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped