-
Notifications
You must be signed in to change notification settings - Fork 52
CASSSIDECAR-243: Implementation of CDCPublisher #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
jyothsnakonisa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, leaving some comments.
server/src/main/java/org/apache/cassandra/sidecar/cdc/CachingSchemaStore.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/cdc/CachingSchemaStore.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/cdc/CachingSchemaStore.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/cdc/CachingSchemaStore.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/cdc/CachingSchemaStore.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/modules/CdcModule.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/tasks/CdcConfigRefresherNotifierTask.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/tasks/ClusterTopologyMonitor.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/cassandra/sidecar/tasks/ClusterTopologyMonitor.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Test | ||
| void testConfigChanged() throws Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this test? I think this is valuable to have a test for checking callback and config updating when config is changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This became a periodic task, and the callback was moved to a vertx signal instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think the test is sill valid right? may be we should have the test to check if the vertx signal is made when config is changed
|
Thanks @bbotella for addressing my comments. There is this comment #294 (comment) which is not resolved. We need to look into that codepath as it is critical for leader election and mutation publishing. Also, can you please check if there is a way to add an end to end test that checks if the mutations are published(in-memory) might not need to have kafka for the test. Other than those two everything else looks good to me. |
jyothsnakonisa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Bernardo for the patch!
CASSSIDECAR-242: Implementation of CachingSchemaStore House cleanup WIP commit Working CDC on Sidecar Latest changes Working CDC Working Working
73efd40 to
b594d40
Compare
| */ | ||
| public BigInteger decodeFromWire(int pos, Buffer buf) | ||
| { | ||
| return decodeFromWire(new MutableInt(pos), buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the MutableInt is only required if we need to track the change in position in a wrapper serializer, this would be marginally faster as:
| return decodeFromWire(new MutableInt(pos), buf); | |
| return new BigInteger(CommonCodecs.BYTE_ARRAY.decodeFromWire(pos, buf)); |
| private volatile Map<String, String> kafkaConfigMappings = Map.of(); | ||
| private volatile Map<String, String> cdcConfigMappings = Map.of(); | ||
|
|
||
| private Map<String, String> kafkaConfigMappings = Map.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look like they should be volatile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There not accessed with synchronized so better to make them volatile
| } | ||
| }); | ||
| })) | ||
| .collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result of .collect(Collectors.toList()); is ignored/not used.
| } | ||
|
|
||
| // NEW: Deduplicate by (instanceId, tokenRange) to prevent duplicate consumers | ||
| Map<String, SidecarCdc> uniqueConsumers = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Map<String, SidecarCdc> uniqueConsumers = new HashMap<>(); | |
| Map<String, SidecarCdc> uniqueConsumers = new HashMap<>(ownedRanges.values().stream().mapToInt(Set::size).sum()); |
| return -1; | ||
| } | ||
|
|
||
| private boolean resolveToSameAddress(String host1, String host2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this only expects ip addresses to be input, and so will not perform DNS resolution. Can we make that explicit? We can also make the method static and add some unit tests here.
| { | ||
| for (InstanceMetadata instance : instanceFetcher.allLocalInstances()) | ||
| { | ||
| String configuredHost = instance.ipAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an ip address, no?
| String configuredHost = instance.ipAddress(); | |
| String configuredIpAddress = instance.ipAddress(); |
| private final ICdcStats cdcStats; | ||
| private final SidecarConfiguration sidecarConfiguration; | ||
| private CdcManager cdcManager; | ||
| private Serializer<CdcEvent> avroSerializer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be final:
| private Serializer<CdcEvent> avroSerializer; | |
| private final Serializer<CdcEvent> avroSerializer; | |
| private final Provider<RangeManager> rangeManagerProvider; |
jberragan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nits, +1 (nb)
Patch by James Berragan, Jyothsna Konisa, Bernardo Botella; reviewed by for CASSSIDECAR-243