prateekm commented on a change in pull request #981: SAMZA-2152 : Bugfix:
Making KafkaSytemAdmin's metadataConsumer accesses thread-safe, enabling
StreamRegexMonitors only when required
URL: https://github.com/apache/samza/pull/981#discussion_r271393999
##########
File path:
samza-kafka/src/main/java/org/apache/samza/system/kafka/KafkaSystemAdmin.java
##########
@@ -231,11 +231,13 @@ public String getUpcomingOffset() {
streamNames.forEach(streamName -> {
Map<Partition,
SystemStreamMetadata.SystemStreamPartitionMetadata> partitionMetadata = new
HashMap<>();
- List<PartitionInfo> partitionInfos =
metadataConsumer.partitionsFor(streamName);
- LOG.debug("Stream {} has partitions {}", streamName,
partitionInfos);
-
- partitionInfos.forEach(partitionInfo ->
partitionMetadata.put(new Partition(partitionInfo.partition()), dummySspm));
+ synchronized (metadataConsumer) {
Review comment:
Let's add a comment on the metadataConsumer field that all access needs to
be synchronized (and explain why).
Also, if possible let's make it private.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services