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 TypeMethodDescriptionstatic booleanisDualWriteToExternalStorageFromVpjEnabled(VeniceProperties jobProps, StorageMode targetStorageMode) Returns 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) Load the configuredExternalStorageWriterand invokeExternalStorageWriter.configure(com.linkedin.venice.utils.VeniceProperties, java.lang.String, int).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
public static boolean isDualWriteToExternalStorageFromVpjEnabled(VeniceProperties jobProps, StorageMode targetStorageMode) 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-version-side
targetStorageModeisStorageMode.DUAL_WRITE(i.e. the version being pushed to has opted into dual-write at the store level).
- The VPJ-side
-
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) Load the configuredExternalStorageWriterand invokeExternalStorageWriter.configure(com.linkedin.venice.utils.VeniceProperties, java.lang.String, int). 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.
-