Class/Object

kafka.log

Log

Related Docs: object Log | package log

Permalink

class Log extends Logging with KafkaMetricsGroup

An append-only log for storing messages.

The log is a sequence of LogSegments, each with a base offset denoting the first message in the segment.

New log segments are created according to a configurable policy that controls the size in bytes or time interval for a given segment.

Annotations
@threadsafe()
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Log
  2. KafkaMetricsGroup
  3. Logging
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Log(dir: File, config: LogConfig, recoveryPoint: Long = 0L, scheduler: Scheduler, time: Time = SystemTime)

    Permalink

    dir

    The directory in which log segments are created.

    config

    The log configuration settings

    recoveryPoint

    The offset at which to begin recovery--i.e. the first offset which has not been flushed to disk

    scheduler

    The thread pool scheduler used for background actions

    time

    The time instance used for checking the clock

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 activeSegment: LogSegment

    Permalink

    The active segment that is currently taking appends

  5. def addSegment(segment: LogSegment): LogSegment

    Permalink

    Add the given segment to the segments in this log.

    Add the given segment to the segments in this log. If this segment replaces an existing segment, delete it.

    segment

    The segment to add

  6. def append(messages: ByteBufferMessageSet, assignOffsets: Boolean = true): LogAppendInfo

    Permalink

    Append this message set to the active segment of the log, rolling over to a fresh segment if necessary.

    Append this message set to the active segment of the log, rolling over to a fresh segment if necessary.

    This method will generally be responsible for assigning offsets to the messages, however if the assignOffsets=false flag is passed we will only check that the existing offsets are valid.

    messages

    The message set to append

    assignOffsets

    Should the log assign offsets to this message set or blindly apply what it is given

    returns

    Information about the appended messages including the first and last offset.

    Exceptions thrown

    KafkaStorageException If the append fails due to an I/O error.

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

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

    Permalink

    Close this log

  10. var config: LogConfig

    Permalink

    The log configuration settings

  11. def convertToOffsetMetadata(offset: Long): LogOffsetMetadata

    Permalink

    Given a message offset, find its corresponding offset metadata in the log.

    Given a message offset, find its corresponding offset metadata in the log. If the message offset is out of range, return unknown offset metadata

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

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

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

    Permalink
    Definition Classes
    Logging
  15. def deleteOldSegments(predicate: (LogSegment) ⇒ Boolean): Int

    Permalink

    Delete any log segments matching the given predicate function, starting with the oldest segment and moving forward until a segment doesn't match.

    Delete any log segments matching the given predicate function, starting with the oldest segment and moving forward until a segment doesn't match.

    predicate

    A function that takes in a single log segment and returns true iff it is deletable

    returns

    The number of segments deleted

  16. val dir: File

    Permalink

    The directory in which log segments are created.

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

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

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

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

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

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

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

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

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

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

    Permalink

    Flush log segments for all offsets up to offset-1

    Flush log segments for all offsets up to offset-1

    offset

    The offset to flush up to (non-inclusive); the new recovery point

  27. def flush(): Unit

    Permalink

    Flush all log segments

  28. final def getClass(): Class[_]

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

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

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

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

    Permalink
    Definition Classes
    Logging
  33. def initFileSize(): Int

    Permalink
  34. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  35. def lastFlushTime(): Long

    Permalink

    The time this log is last known to have been fully flushed to disk

  36. def logEndOffset: Long

    Permalink

    The offset of the next message that will be appended to the log

  37. def logEndOffsetMetadata: LogOffsetMetadata

    Permalink

    The offset metadata of the next message that will be appended to the log

  38. var logIdent: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  39. def logSegments(from: Long, to: Long): Iterable[LogSegment]

    Permalink

    Get all segments beginning with the segment that includes "from" and ending with the segment that includes up to "to-1" or the end of the log (if to > logEndOffset)

  40. def logSegments: Iterable[LogSegment]

    Permalink

    All the log segments in this log ordered from oldest to newest

  41. def logStartOffset: Long

    Permalink

    The earliest message offset in the log

  42. lazy val logger: Logger

    Permalink
    Definition Classes
    Logging
  43. val loggerName: String

    Permalink
    Definition Classes
    Logging
  44. def name: String

    Permalink

    The name of this log

  45. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  46. def newGauge[T](name: String, metric: Gauge[T], tags: Map[String, String] = Map.empty): Gauge[T]

    Permalink
    Definition Classes
    KafkaMetricsGroup
  47. def newHistogram(name: String, biased: Boolean = true, tags: Map[String, String] = Map.empty): Histogram

    Permalink
    Definition Classes
    KafkaMetricsGroup
  48. def newMeter(name: String, eventType: String, timeUnit: TimeUnit, tags: Map[String, String] = Map.empty): Meter

    Permalink
    Definition Classes
    KafkaMetricsGroup
  49. def newTimer(name: String, durationUnit: TimeUnit, rateUnit: TimeUnit, tags: Map[String, String] = Map.empty): Timer

    Permalink
    Definition Classes
    KafkaMetricsGroup
  50. var nextOffsetMetadata: LogOffsetMetadata

    Permalink
  51. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  53. def numberOfSegments: Int

    Permalink

    The number of segments in the log.

    The number of segments in the log. Take care! this is an O(n) operation.

  54. def read(startOffset: Long, maxLength: Int, maxOffset: Option[Long] = None): FetchDataInfo

    Permalink

    Read messages from the log

    Read messages from the log

    startOffset

    The offset to begin reading at

    maxLength

    The maximum number of bytes to read

    maxOffset

    -The offset to read up to, exclusive. (i.e. the first offset NOT included in the resulting message set).

    returns

    The fetch data information including fetch starting offset metadata and messages read

    Exceptions thrown

    OffsetOutOfRangeException If startOffset is beyond the log end offset or before the base offset of the first segment.

  55. var recoveryPoint: Long

    Permalink

    The offset at which to begin recovery--i.e.

    The offset at which to begin recovery--i.e. the first offset which has not been flushed to disk

  56. def removeMetric(name: String, tags: Map[String, String] = Map.empty): Unit

    Permalink
    Definition Classes
    KafkaMetricsGroup
  57. def roll(): LogSegment

    Permalink

    Roll the log over to a new active segment starting with the current logEndOffset.

    Roll the log over to a new active segment starting with the current logEndOffset. This will trim the index to the exact size of the number of entries it currently contains.

    returns

    The newly rolled segment

  58. def size: Long

    Permalink

    The size of the log in bytes

  59. def swallow(action: ⇒ Unit): Unit

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  66. val tags: Map[String, String]

    Permalink
  67. def toString(): String

    Permalink
    Definition Classes
    Log → AnyRef → Any
  68. val topicAndPartition: TopicAndPartition

    Permalink
  69. def trace(msg: ⇒ String, e: ⇒ Throwable): Unit

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

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

    Permalink
    Definition Classes
    Logging
  72. def unflushedMessages(): Long

    Permalink

    The number of messages appended to the log since the last flush

  73. final def wait(): Unit

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

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

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

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

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

    Permalink
    Definition Classes
    Logging

Inherited from KafkaMetricsGroup

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped