mattisonchao commented on code in PR #20645:
URL: https://github.com/apache/pulsar/pull/20645#discussion_r1246040962
##########
pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactedTopicImpl.java:
##########
@@ -317,9 +317,13 @@ private static int
comparePositionAndMessageId(PositionImpl p, MessageIdData m)
.compare(p.getEntryId(), m.getEntryId()).result();
}
- public synchronized Optional<Position> getCompactionHorizon() {
+ public Optional<Position> getCompactionHorizon() {
return Optional.ofNullable(this.compactionHorizon);
}
+
+ public CompletableFuture<CompactedTopicContext>
getCompactedTopicContextFuture() {
+ return compactedTopicContext;
Review Comment:
The `compactedTopicContext` can be null. It's a risk of NPE for the caller.
Because the caller will call this method in chain mode.
##########
pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactedTopicImpl.java:
##########
@@ -317,9 +317,13 @@ private static int
comparePositionAndMessageId(PositionImpl p, MessageIdData m)
.compare(p.getEntryId(), m.getEntryId()).result();
}
- public synchronized Optional<Position> getCompactionHorizon() {
+ public Optional<Position> getCompactionHorizon() {
return Optional.ofNullable(this.compactionHorizon);
}
+
+ public CompletableFuture<CompactedTopicContext>
getCompactedTopicContextFuture() {
+ return compactedTopicContext;
Review Comment:
The `compactedTopicContext` can be null. It's a risk of NPE for the caller.
Because the caller will call this method in chain mode. :)
--
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]