jyothsnakonisa commented on code in PR #188:
URL:
https://github.com/apache/cassandra-analytics/pull/188#discussion_r3017330229
##########
cassandra-analytics-cdc-sidecar/src/main/java/org/apache/cassandra/cdc/sidecar/SidecarCdcBuilder.java:
##########
@@ -61,21 +56,11 @@ public class SidecarCdcBuilder extends CdcBuilder
SecretsProvider secretsProvider,
ICdcStats cdcStats) throws IOException
{
- this(
- jobId,
- partitionId,
- cdcOptions,
- clusterConfigProvider,
- eventConsumer,
- schemaSupplier,
- tokenRangeSupplier,
- clientConfig,
- Sidecar.from(new
SimpleSidecarInstancesProvider(sidecarInstancesProvider.instances().stream()
-
.map(i -> new SidecarInstanceImpl(i.hostname(), i.port()))
-
.collect(Collectors.toList())),
- clientConfig.toGenericSidecarConfig(), secretsProvider),
- cdcStats
- );
+ super(jobId, partitionId, eventConsumer, schemaSupplier);
+ this.clusterConfigProvider = clusterConfigProvider;
+ this.sidecarCdcClient = new SidecarCdcClient(clientConfig,
sidecarInstancesProvider, secretsProvider, cdcStats);
+ withCdcOptions(cdcOptions);
+ withTokenRangeSupplier(tokenRangeSupplier);
}
Review Comment:
We want the `SidecarCdcClient` object to be singleton created in the Sidecar
process and it should be shared across all the `SidecarCdc` instances which are
CDC iterators.
I have added this new constructor to take `sidecarCdcClient` object as
parameter so that we can have singleton object and can pass it to all iterators
to avoid creating one `sidecarCdcClient` instance per iterator.
If we have the `SidecarCdcClient` creation inside the constructor, then on
token range change when new iterator is created a new `SidecarCdcClient` is
created, which we want to avoid.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]