You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by di...@apache.org on 2023/07/08 10:53:54 UTC

[kafka] branch trunk updated: MINOR: Print startup time for RemoteIndexCache (#13970)

This is an automated email from the ASF dual-hosted git repository.

divijv pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d481163d55a MINOR: Print startup time for RemoteIndexCache (#13970)
d481163d55a is described below

commit d481163d55a1cea3206fa6e386b24ac84e17c3d7
Author: DL1231 <53...@users.noreply.github.com>
AuthorDate: Sat Jul 8 18:53:47 2023 +0800

    MINOR: Print startup time for RemoteIndexCache (#13970)
    
    Reviewers: Satish Duggana <sa...@apache.org>, Divij Vaidya <di...@amazon.com>
    
    Co-authored-by: d00791190 <di...@huawei.com>
---
 core/src/main/scala/kafka/log/remote/RemoteIndexCache.scala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/src/main/scala/kafka/log/remote/RemoteIndexCache.scala b/core/src/main/scala/kafka/log/remote/RemoteIndexCache.scala
index ebff3444984..7c035c1a336 100644
--- a/core/src/main/scala/kafka/log/remote/RemoteIndexCache.scala
+++ b/core/src/main/scala/kafka/log/remote/RemoteIndexCache.scala
@@ -23,7 +23,7 @@ import kafka.utils.CoreUtils.{inReadLock, inWriteLock}
 import kafka.utils.{CoreUtils, Logging, threadsafe}
 import org.apache.kafka.common.Uuid
 import org.apache.kafka.common.errors.CorruptRecordException
-import org.apache.kafka.common.utils.Utils
+import org.apache.kafka.common.utils.{Utils, Time}
 import org.apache.kafka.server.log.remote.storage.RemoteStorageManager.IndexType
 import org.apache.kafka.server.log.remote.storage.{RemoteLogSegmentMetadata, RemoteStorageManager}
 import org.apache.kafka.storage.internals.log.{LogFileUtils, OffsetIndex, OffsetPosition, TimeIndex, TransactionIndex}
@@ -238,6 +238,7 @@ class RemoteIndexCache(maxSize: Int = 1024, remoteStorageManager: RemoteStorageM
     .build[Uuid, Entry]()
 
   private def init(): Unit = {
+    val start = Time.SYSTEM.hiResClockMs()
     try {
       Files.createDirectory(cacheDir.toPath)
       info(s"Created new file $cacheDir for RemoteIndexCache")
@@ -292,6 +293,7 @@ class RemoteIndexCache(maxSize: Int = 1024, remoteStorageManager: RemoteStorageM
         }
       }
     })
+    info(s"RemoteIndexCache starts up in ${Time.SYSTEM.hiResClockMs() - start} ms.")
   }
 
   init()