kafka.log

Log

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
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

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

    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

Type Members

  1. case class LogAppendInfo(firstOffset: Long, lastOffset: Long, codec: CompressionCodec, shallowCount: Int, validBytes: Int, offsetsMonotonic: Boolean) extends Product with Serializable

    Struct to hold various quantities we compute about each message set before appending to the log

    Struct to hold various quantities we compute about each message set before appending to the log

    firstOffset

    The first offset in the message set

    lastOffset

    The last offset in the message set

    codec

    The codec used in the message set

    shallowCount

    The number of shallow messages

    validBytes

    The number of valid bytes

    offsetsMonotonic

    Are the offsets in this message set monotonically increasing

Value Members

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

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

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

    Definition Classes
    AnyRef → Any
  4. def activeSegment: LogSegment

    The active segment that is currently taking appends

  5. def addSegment(segment: LogSegment): LogSegment

    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

    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

    Definition Classes
    Any
  8. def clone(): AnyRef

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

    Close this log

  10. var config: LogConfig

    The log configuration settings

  11. def convertToOffsetMetadata(offset: Long): LogOffsetMetadata

    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

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

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

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

    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

    The directory in which log segments are created.

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

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

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

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

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

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

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

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

    Definition Classes
    Logging
  25. def finalize(): Unit

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

    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

    Flush all log segments

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

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

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

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

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

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

    Definition Classes
    Any
  34. def lastFlushTime(): Long

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

  35. def logEndOffset: Long

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

  36. def logEndOffsetMetadata: LogOffsetMetadata

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

  37. var logIdent: String

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

    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)

  39. def logSegments: Iterable[LogSegment]

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

  40. def logStartOffset: Long

    The earliest message offset in the log

  41. lazy val logger: Logger

    Definition Classes
    Logging
  42. val loggerName: String

    Definition Classes
    Logging
  43. def name: String

    The name of this log

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

    Definition Classes
    AnyRef
  45. def newGauge[T](name: String, metric: Gauge[T]): Gauge[T]

    Definition Classes
    KafkaMetricsGroup
  46. def newHistogram(name: String, biased: Boolean = true): Histogram

    Definition Classes
    KafkaMetricsGroup
  47. def newMeter(name: String, eventType: String, timeUnit: TimeUnit): Meter

    Definition Classes
    KafkaMetricsGroup
  48. def newTimer(name: String, durationUnit: TimeUnit, rateUnit: TimeUnit): Timer

    Definition Classes
    KafkaMetricsGroup
  49. var nextOffsetMetadata: LogOffsetMetadata

  50. final def notify(): Unit

    Definition Classes
    AnyRef
  51. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  52. def numberOfSegments: Int

    The number of segments in the log.

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

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

    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.

  54. var recoveryPoint: Long

    The offset at which to begin recovery--i.

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

  55. def removeMetric(name: String): Unit

    Definition Classes
    KafkaMetricsGroup
  56. def roll(): LogSegment

    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

  57. def size: Long

    The size of the log in bytes

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

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

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

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

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

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

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

    Definition Classes
    AnyRef
  65. def toString(): String

    Definition Classes
    Log → AnyRef → Any
  66. val topicAndPartition: TopicAndPartition

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

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

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

    Definition Classes
    Logging
  70. def unflushedMessages(): Long

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

  71. final def wait(): Unit

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

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

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

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

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

    Definition Classes
    Logging

Inherited from KafkaMetricsGroup

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped