clolov commented on code in PR #18100:
URL: https://github.com/apache/kafka/pull/18100#discussion_r1877950678


##########
core/src/main/java/kafka/log/remote/RemoteLogOffsetReader.java:
##########
@@ -61,17 +60,18 @@ public RemoteLogOffsetReader(RemoteLogManager rlm,
 
     @Override
     public Void call() throws Exception {
-        Either<Exception, Option<FileRecords.TimestampAndOffset>> result;
+        OffsetResultHolder.FileRecordsOrError result;
         try {
             // If it is not found in remote storage, then search in the local 
storage starting with local log start offset.
             Option<FileRecords.TimestampAndOffset> timestampAndOffsetOpt =
                     OptionConverters.toScala(rlm.findOffsetByTimestamp(tp, 
timestamp, startingOffset, leaderEpochCache))
                     .orElse(searchInLocalLog::get);
-            result = Right.apply(timestampAndOffsetOpt);
+            result = new 
OffsetResultHolder.FileRecordsOrError(Optional.empty(),
+                    timestampAndOffsetOpt.isDefined() ? 
Optional.of(timestampAndOffsetOpt.get()) : Optional.empty());

Review Comment:
   Still, maybe something like 
https://www.scala-lang.org/api/2.13.6/scala/jdk/OptionConverters$.html will 
simplify this?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to