Enum Class VtpHeaderEmissionMode

java.lang.Object
java.lang.Enum<VtpHeaderEmissionMode>
com.linkedin.venice.writer.VtpHeaderEmissionMode
All Implemented Interfaces:
Serializable, Comparable<VtpHeaderEmissionMode>, Constable

public enum VtpHeaderEmissionMode extends Enum<VtpHeaderEmissionMode>
Controls whether VeniceWriter attaches the vtp protocol-schema header to outbound messages.

The vtp header carries the Avro JSON for KafkaMessageEnvelope (~16 KB) and is only useful to consumers that need to bootstrap the schema for forward compatibility. Pre-existing behavior emits it on outbound messages whose producer metadata satisfies segmentNumber == 0 && messageSequenceNumber == 0. On the data path that gate only matches the very first segment-start record produced on a partition (segment 0, sequence 0); subsequent data SOS records use non-zero segmentNumber and are not affected. Heartbeat control messages, however, are synthesized with both coordinates pinned to 0 (see VeniceWriter.getHeartbeatKME(long, com.linkedin.venice.writer.LeaderMetadataWrapper, com.linkedin.venice.kafka.protocol.ControlMessage, java.lang.String)), so every heartbeat matches the gate and picks up the ~16 KB header even though heartbeat consumers never use it for schema bootstrap. On busy ingestion paths with many partitions and frequent heartbeats this dominates the per-record memory footprint.

This mode lets writers opt out of the heartbeat case (or out entirely) without changing the semantics of regular data segment-start records.

  • Enum Constant Details

    • SOS_AND_HB

      public static final VtpHeaderEmissionMode SOS_AND_HB
      Emit the vtp header on every segment-start message, including heartbeat SOS records. Default, preserves pre-existing behavior.
    • SOS_ONLY

      public static final VtpHeaderEmissionMode SOS_ONLY
      Emit the vtp header on non-heartbeat segment-start messages (data SOS and DoL stamps); skip heartbeat SOS records. DoL stamps are START_OF_SEGMENT control messages that carry segmentNumber=0 / messageSequenceNumber=0 (like heartbeats) but are not heartbeats — they need the vtp header so a forward-compat consumer hitting a DoL as the first record on a fresh VT can bootstrap the KME schema. Consumers are expected to obtain the KafkaMessageEnvelope schema for heartbeat records by some other means (controller-side schema cache, classpath fallback, or an earlier data SOS on the same segment).
    • NONE

      public static final VtpHeaderEmissionMode NONE
      Never emit the vtp header. Use only when all consumers can resolve the KafkaMessageEnvelope schema without the per-segment hint.
  • Method Details

    • values

      public static VtpHeaderEmissionMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static VtpHeaderEmissionMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null