m1a2st commented on code in PR #18100:
URL: https://github.com/apache/kafka/pull/18100#discussion_r1878296834
##########
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:
> Ah, I think I answered my own question - one is a Scala Option and the
other is a Java Optional?
Yes, Scala Option and Java Optional is different type
> Still, maybe something like
https://www.scala-lang.org/api/2.13.6/scala/jdk/OptionConverters$.html will
simplify this?
It a good idea, I will address it :)
--
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]