-
Notifications
You must be signed in to change notification settings - Fork 124
[server] Gate vtp protocol-schema header behind VtpHeaderEmissionMode #2798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sushantmane
merged 2 commits into
linkedin:main
from
sushantmane:sumane/skip-vtp-on-heartbeat-sos
Aug 28, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
internal/venice-common/src/main/java/com/linkedin/venice/writer/VtpHeaderEmissionMode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package com.linkedin.venice.writer; | ||
|
|
||
| /** | ||
| * Controls whether {@link VeniceWriter} attaches the | ||
| * {@link com.linkedin.venice.pubsub.api.PubSubMessageHeaders#VENICE_TRANSPORT_PROTOCOL_HEADER vtp} | ||
| * protocol-schema header to outbound messages. | ||
| * | ||
| * <p>The vtp header carries the Avro JSON for {@code 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 | ||
| * {@code 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 {@code segmentNumber} and are not affected. Heartbeat | ||
| * control messages, however, are synthesized with both coordinates pinned to {@code 0} (see | ||
| * {@link VeniceWriter#getHeartbeatKME}), 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. | ||
| * | ||
| * <p>This mode lets writers opt out of the heartbeat case (or out entirely) without changing the | ||
| * semantics of regular data segment-start records. | ||
| */ | ||
| public enum VtpHeaderEmissionMode { | ||
| /** | ||
| * Emit the vtp header on every segment-start message, including heartbeat SOS records. Default, | ||
| * preserves pre-existing behavior. | ||
| */ | ||
| SOS_AND_HB, | ||
|
|
||
| /** | ||
| * 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 | ||
| * {@code KafkaMessageEnvelope} schema for heartbeat records by some other means (controller-side | ||
| * schema cache, classpath fallback, or an earlier data SOS on the same segment). | ||
| */ | ||
| SOS_ONLY, | ||
|
|
||
| /** | ||
| * Never emit the vtp header. Use only when all consumers can resolve the | ||
| * {@code KafkaMessageEnvelope} schema without the per-segment hint. | ||
| */ | ||
| NONE | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.