[vpj] Fix NorthGuard repush ZSTD dictionary routing - #2942
Conversation
Preserve the configured pub-sub adapter and NorthGuard routing properties when fetching repush dictionaries, while overriding both broker settings to the source broker. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sushantmane
left a comment
There was a problem hiding this comment.
Thanks for tracking this down. The root cause and the buildSourceDictionaryConsumerProperties helper look right. One gap: this fixes the two DictionaryUtils.readDictionaryFromKafka sites but not the KafkaInputDictTrainer (build-new-dict) path, which is the default for a ZSTD repush.
At head (93f668d):
kafkaInputBuildNewDictEnableddefaults totrue(VenicePushJobL434;KAFKA_INPUT_COMPRESSION_BUILD_NEW_DICT_ENABLEDdefaulttrue).- So
fetchOrBuildCompressionDictionary()takes theif (kafkaInputBuildNewDictEnabled)branch (L1700) →new KafkaInputDictTrainer(paramBuilder.build())→trainDict()(L1706). Theelseread-branch you fixed only runs when the flag is explicitlyfalse. - That param builder is still fed SSL-only props:
.setSslProperties(pushJobSetting.enableSSL ? sslProperties.get() : new Properties())(L1689), andKafkaInputDictTrainer.javaisn't in this PR. Inside the trainer,KafkaInputUtils.getConsumerProperties(jobConf)→PubSubClientsFactory.createConsumerFactory(...)then defaults toApacheKafkaConsumerAdapterFactory, the same fallback you're fixing. - The empty-push/hybrid branch at L1757 hits the same trainer with the same SSL-only param.
Net: a standard ZSTD_WITH_DICT repush with default config still builds its dictionary consumer (and the split-planner TopicManager it spawns via getSplits) through Kafka, so a NorthGuard source still returns UNKNOWN_TOPIC_OR_PARTITION on that path.
I reproduced this with a xinfra e2e repush test on a fully-xinfra cluster: the trainer's consumer is constructed as ApacheKafkaConsumerAdapter with clientId CONSUMER-KafkaInputDictTrainer-for-<store>_v1, alongside DictionaryUtilsConsumer (x2) and TopicManager-0.
Suggested extension: thread the same full-config properties into the trainer. Rename KafkaInputDictTrainer.ParamBuilder.setSslProperties → setConsumerProperties (the builder merges these into the full consumer config, so the SSL-only name undersells it) and pass buildSourceDictionaryConsumerProperties(props, sslProperties, repushSourcePubsubBroker).toProperties() at both trainer sites (L1689 and the L1757 path). I can push that follow-up if you'd like.
Pass the complete source consumer configuration into KafkaInputDictTrainer so Xinfra adapters, routing metadata, broker overrides, and SSL credentials are retained for both repush and empty hybrid dictionary training. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise the production dictionary consumer property helper without SSL so the new conditional path is represented in VPJ diff coverage. This keeps the propagation assertions on the same helper used by dictionary reads and training. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Opened #2947 with the trainer-path follow-up — it routes the default build-new-dict path ( |
sushantmane
left a comment
There was a problem hiding this comment.
Verified this now routes all four driver-side dictionary paths through the configured pub-sub adapter: the run() source read, the read branch, the default build-new-dict trainer branch, and the empty-push/hybrid rebuild (with the trainer broker set per path via the parameterized overload). The KafkaInputDictTrainer rename and the constructor ordering (consumer props first, then per-path broker/topic overrides) look correct.
This matches a fix I built independently and verified end-to-end on a fully-xinfra cluster: a ZSTD repush went from 4 ApacheKafkaConsumerAdapter constructions (dict trainer, 2 dictionary reads, split-planner TopicManager) down to 0, all now using the configured adapter. CI is green. LGTM.
Problem Statement
Kafka-input repushes read the source compression dictionary in the Spark driver when the source version uses
ZSTD_WITH_DICT. The dictionary-read paths constructed new consumer properties containing only SSL configuration and a broker address. This discarded the configured pub-sub consumer adapter, Xinfra routing maps, position configuration, and other job-level pub-sub properties.Without the configured adapter factory,
PubSubClientsFactorydefaults toApacheKafkaConsumerAdapterFactory. A NorthGuard-backed source topic is then queried through legacy Kafka, which returnsUNKNOWN_TOPIC_OR_PARTITIONuntil the push job times out.Solution
Build the source dictionary consumer properties from the complete VPJ job configuration, then apply SSL overrides and set both the pub-sub and Kafka broker properties to the repush source broker.
Both driver-side dictionary-read paths now use the same helper. The helper preserves Xinfra and pub-sub configuration without mutating the original job properties. Copying the properties occurs once during driver-side dictionary lookup and has no material performance impact.
Code changes
No new configuration or log lines were introduced.
Concurrency-Specific Checks
Both reviewer and PR author to verify
synchronized,RWLock) are used where needed.ConcurrentHashMap,CopyOnWriteArrayList).This change does not alter concurrency behavior.
How was this PR tested?
All 9 tests passed.
Does this PR introduce any user-facing or breaking changes?