You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "jolshan (via GitHub)" <gi...@apache.org> on 2023/02/10 19:42:52 UTC

[GitHub] [kafka] jolshan commented on a diff in pull request #13196: KAFKA-14673; Add high watermark listener to Partition/Log layers

jolshan commented on code in PR #13196:
URL: https://github.com/apache/kafka/pull/13196#discussion_r1103164836


##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -49,6 +49,35 @@ import org.apache.kafka.server.log.internals.{AppendOrigin, FetchDataInfo, Fetch
 import scala.collection.{Map, Seq}
 import scala.jdk.CollectionConverters._
 
+/**
+ * Listener receives notification from an Online Partition.
+ *
+ * A listener can be (re-)registered to an Online partition only. The listener
+ * is notified as long as the partition remains Online. When the partition fails
+ * or is deleted, respectively `onFailed` or `onDeleted` are called once. No further
+ * notifications are sent after this point on.
+ *
+ * Note that the callbacks are executed in the thread that triggers the change
+ * AND that locks may be held during their execution. They are meant to be used
+ * as notification mechanism only.
+ */
+trait PartitionListener {
+  /**
+   * Called when the Log increments its high watermark.
+   */
+  def onHighWatermarkUpdated(partition: TopicPartition, offset: Long): Unit = {}
+
+  /**
+   * Called when the Partition has a failure (e.g. goes offline).
+   */
+  def onFailed(partition: TopicPartition): Unit = {}

Review Comment:
   It seems in this PR these two do nothing. Are there plans to use them in the future?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org