Package com.linkedin.venice.vpj
Class ExternalStorageWriteUtils
java.lang.Object
com.linkedin.venice.vpj.ExternalStorageWriteUtils
Helpers for the VPJ external-storage dual-write path: the gating predicate, the typed reflective loader
for
ExternalStorageWriter impls, and the load+configure helper that ensures the impl is closed
if configuration fails.-
Method Summary
Modifier and TypeMethodDescriptiongetDualWriteTargetRegions(VeniceProperties jobProps) Parse thepush.job.dual.write.target.regionsconfig into the ordered list of region names whose store-level storage mode isDUAL_WRITE.static booleanReturns true iff both halves of the dual-write gate are satisfied: The VPJ-sidepush.job.external.storage.writer.classconfig is set to a non-empty value (i.e.static ExternalStorageWriterloadAndConfigure(String className, VeniceProperties jobProps, String topicName, int partitionId, String region) Load the configuredExternalStorageWriterand invokeExternalStorageWriter.configure(VeniceProperties, String, int, String)forregion.static ExternalStorageWriterloadExternalStorageWriter(String className) Reflectively load and instantiate anExternalStorageWriterimplementation, validating that the configured class actually implements the interface before invoking its no-arg constructor.
-
Method Details
-
isDualWriteToExternalStorageFromVpjEnabled
Returns true iff both halves of the dual-write gate are satisfied:- The VPJ-side
push.job.external.storage.writer.classconfig is set to a non-empty value (i.e. an implementation is wired in for this push). - The store-side
push.job.dual.write.target.regionslist is non-empty (i.e. at least one region's store-level storage mode isDUAL_WRITE). The VPJ driver resolves each region's storage mode and forwards only theDUAL_WRITEregions; an empty list means no region opted in.
- The VPJ-side
-
getDualWriteTargetRegions
Parse thepush.job.dual.write.target.regionsconfig into the ordered list of region names whose store-level storage mode isDUAL_WRITE. Comma-separated; blank entries are dropped and duplicates are collapsed (first occurrence order preserved) so a repeated region never yields more than one writer. Returns an empty list when the key is absent or empty. -
loadExternalStorageWriter
Reflectively load and instantiate anExternalStorageWriterimplementation, validating that the configured class actually implements the interface before invoking its no-arg constructor.- Throws:
VeniceException- with a precise message when the class cannot be loaded, does not implement the SPI, or cannot be instantiated. Wrapping the underlying causes keeps stack traces useful while surfacing the configured class name in the message for operators triaging mis-configured pushes.
-
loadAndConfigure
public static ExternalStorageWriter loadAndConfigure(String className, VeniceProperties jobProps, String topicName, int partitionId, String region) Load the configuredExternalStorageWriterand invokeExternalStorageWriter.configure(VeniceProperties, String, int, String)forregion. Ifconfigurethrows, the partially-constructed writer is closed (best-effort) before the exception is propagated, so executor tasks do not leak connection pools / file handles / etc.
-