[
https://issues.apache.org/jira/browse/CASSSIDECAR-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jyothsna Konisa updated CASSSIDECAR-511:
----------------------------------------
Description:
CDC components in Sidecar obtain their Cassandra bridge through the static
CdcBridgeFactory.get(releaseVersion), called separately in CdcPublisher,
CdcSchemaSupplier, SidecarCdcOptions, SidecarCqlToAvroSchemaConverter and
CassandraClusterSchemaMonitor. Because the lookup is static and repeated at
each call site, deployments cannot customize how the bridge is obtained, and
tests have to mock static methods.
This change makes the bridge a Guice binding:
- CdcModule provides CassandraBridge from the release version of the first
available instance.
- The CDC components inject Provider<CassandraBridge> and call get() where they
previously called the static factory.
- SidecarCdcOptions.version() returns the version of the provided bridge, and
still falls back to FOURZERO when the release version is not supported.
The binding is intentionally unscoped, so that the bridge is resolved on each
use rather than once:
- The local Cassandra instances may be unreachable when Sidecar starts, and a
singleton would fail injection at startup.
- The instances may be upgraded to another Cassandra version while Sidecar
runs, and a singleton would keep using the bridge of the previous version.
CdcBridgeFactory caches bridges per version, so repeated get() calls return the
same bridge until the version changes.
Deployments can now customize bridge resolution by overriding the single
CassandraBridge binding.
was:The Sidecar's CDC components used to obtain Cassandra bridges through an
injectable org.apache.cassandra.sidecar.bridge.CassandraBridgeFactory, provided
by CdcModule. It was removed during CASSSIDECAR-507. Since then, the CDC
components call the static org.apache.cassandra.bridge.CdcBridgeFactory from
cassandra-analytics directly, and SidecarCdcOptions resolves the Cassandra
version with the static CassandraVersion.fromVersion(…).Because these calls
are static, how CDC resolves a Cassandra instance's version and obtains its
bridge is no longer an extension point. Deployments that embed the Sidecar and
supply their own Guice modules (via Modules.override) can't customize it, and
tests have to go through the static factories instead of injecting a stub.
> Make the CDC CassandraBridge injectable
> ---------------------------------------
>
> Key: CASSSIDECAR-511
> URL: https://issues.apache.org/jira/browse/CASSSIDECAR-511
> Project: Sidecar for Apache Cassandra
> Issue Type: Bug
> Reporter: Jyothsna Konisa
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> CDC components in Sidecar obtain their Cassandra bridge through the static
> CdcBridgeFactory.get(releaseVersion), called separately in CdcPublisher,
> CdcSchemaSupplier, SidecarCdcOptions, SidecarCqlToAvroSchemaConverter and
> CassandraClusterSchemaMonitor. Because the lookup is static and repeated at
> each call site, deployments cannot customize how the bridge is obtained, and
> tests have to mock static methods.
> This change makes the bridge a Guice binding:
> - CdcModule provides CassandraBridge from the release version of the first
> available instance.
> - The CDC components inject Provider<CassandraBridge> and call get() where
> they previously called the static factory.
> - SidecarCdcOptions.version() returns the version of the provided bridge, and
> still falls back to FOURZERO when the release version is not supported.
> The binding is intentionally unscoped, so that the bridge is resolved on each
> use rather than once:
> - The local Cassandra instances may be unreachable when Sidecar starts, and a
> singleton would fail injection at startup.
> - The instances may be upgraded to another Cassandra version while Sidecar
> runs, and a singleton would keep using the bridge of the previous version.
> CdcBridgeFactory caches bridges per version, so repeated get() calls return
> the same bridge until the version changes.
> Deployments can now customize bridge resolution by overriding the single
> CassandraBridge binding.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]