You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/08 01:38:15 UTC

[GitHub] [kafka] ijuma opened a new pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

ijuma opened a new pull request #10080:
URL: https://github.com/apache/kafka/pull/10080


   We don't need or use the additional functionality provided by
   AtomicReference.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [kafka] ijuma merged pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

Posted by GitBox <gi...@apache.org>.
ijuma merged pull request #10080:
URL: https://github.com/apache/kafka/pull/10080


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [kafka] ijuma commented on a change in pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

Posted by GitBox <gi...@apache.org>.
ijuma commented on a change in pull request #10080:
URL: https://github.com/apache/kafka/pull/10080#discussion_r571791073



##########
File path: core/src/main/scala/kafka/server/KafkaBroker.scala
##########
@@ -71,8 +70,11 @@ object KafkaBroker {
 }
 
 trait KafkaBroker extends KafkaMetricsGroup {
+  @volatile private var _brokerState: BrokerState = BrokerState.NOT_RUNNING

Review comment:
       Because that would make it mutable for everyone. The current implementation is mutable only within subclasses.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [kafka] chia7712 commented on a change in pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #10080:
URL: https://github.com/apache/kafka/pull/10080#discussion_r571766669



##########
File path: core/src/main/scala/kafka/server/KafkaBroker.scala
##########
@@ -71,8 +70,11 @@ object KafkaBroker {
 }
 
 trait KafkaBroker extends KafkaMetricsGroup {
+  @volatile private var _brokerState: BrokerState = BrokerState.NOT_RUNNING

Review comment:
       Why not using ```@volatile var brokerState: BrokerState = BrokerState.NOT_RUNNING```? 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [kafka] ijuma commented on a change in pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

Posted by GitBox <gi...@apache.org>.
ijuma commented on a change in pull request #10080:
URL: https://github.com/apache/kafka/pull/10080#discussion_r573809578



##########
File path: core/src/main/scala/kafka/server/KafkaBroker.scala
##########
@@ -90,7 +92,7 @@ trait KafkaBroker extends KafkaMetricsGroup {
     explicitMetricName(KafkaBroker.metricsPrefix, KafkaBroker.metricsTypeName, name, metricTags)
   }
 
-  newGauge("BrokerState", () => brokerState.get.value())
+  newGauge("BrokerState", () => brokerState.value)

Review comment:
       Right. To change this, it would require a KIP.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [kafka] ijuma commented on pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

Posted by GitBox <gi...@apache.org>.
ijuma commented on pull request #10080:
URL: https://github.com/apache/kafka/pull/10080#issuecomment-774813556


   cc @rondagostino 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [kafka] chia7712 commented on a change in pull request #10080: MINOR: KafkaBroker.brokerState should be volatile instead of AtomicReference

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #10080:
URL: https://github.com/apache/kafka/pull/10080#discussion_r573418590



##########
File path: core/src/main/scala/kafka/server/KafkaBroker.scala
##########
@@ -90,7 +92,7 @@ trait KafkaBroker extends KafkaMetricsGroup {
     explicitMetricName(KafkaBroker.metricsPrefix, KafkaBroker.metricsTypeName, name, metricTags)
   }
 
-  newGauge("BrokerState", () => brokerState.get.value())
+  newGauge("BrokerState", () => brokerState.value)

Review comment:
       (this is not related to this PR) it is a bit weird to me that we expose "byte" as "broker state".




----------------------------------------------------------------
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:
users@infra.apache.org