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 2020/05/24 06:43:01 UTC

[GitHub] [kafka] senthilm-ms commented on a change in pull request #8103: KAFKA-7061: KIP-280 Enhanced log compaction

senthilm-ms commented on a change in pull request #8103:
URL: https://github.com/apache/kafka/pull/8103#discussion_r429605034



##########
File path: core/src/main/scala/kafka/log/OffsetMap.scala
##########
@@ -20,28 +20,80 @@ package kafka.log
 import java.util.Arrays
 import java.security.MessageDigest
 import java.nio.ByteBuffer
+
+import kafka.log.CompactionStrategy.CompactionStrategy
 import kafka.utils._
-import org.apache.kafka.common.utils.Utils
+import org.apache.kafka.common.record.Record
+import org.apache.kafka.common.utils.{ByteUtils, Utils}
 
 trait OffsetMap {
+  /* The maximum number of entries this map can contain */
   def slots: Int
-  def put(key: ByteBuffer, offset: Long): Unit
-  def get(key: ByteBuffer): Long
+
+  /* Initialize the map with the topic compact strategy */
+  def init(strategy: String, headerKey: String, cleanerThreadId: Int, topicPartitionName: String)
+
+  /**
+   * Associate this offset to the given key.
+   * @param record The record
+   * @return success flag
+   */
+  def put(record: Record): Boolean
+
+  /**
+   * Checks to see whether to retain the record or not
+   * @param record The record
+   * @return true to retain; false not to
+   */
+  def shouldRetainRecord(record: Record): Boolean
+
+  /**
+   * Get the offset associated with this key.
+   * @param key The key
+   * @return The offset associated with this key or -1 if the key is not found
+   */
+  def getOffset(key: ByteBuffer): Long
+
+  /**
+   * Get the version associated with this key for non-offset based strategy.
+   * @param key The key
+   * @return The version associated with this key or -1 if the key is not found
+   */
+  def getVersion(key: ByteBuffer): Long
+
+  /**
+   * Sets the passed value as the latest offset.
+   * @param offset teh latest offset
+   */
   def updateLatestOffset(offset: Long): Unit
-  def clear(): Unit
+
+  /* The number of entries put into the map (note that not all may remain) */

Review comment:
       removed




----------------------------------------------------------------
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