cameronlee314 commented on a change in pull request #1133: SAMZA-2297: 
InMemorySystemAdmin offsets are off-by-one in some cases 
URL: https://github.com/apache/samza/pull/1133#discussion_r323488987
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/system/inmemory/InMemoryManager.java
 ##########
 @@ -179,9 +179,10 @@ private SystemStreamMetadata 
constructSystemStreamMetadata(
             .entrySet()
             .stream()
             .collect(Collectors.toMap(entry -> entry.getKey().getPartition(), 
entry -> {
-                String oldestOffset = "0";
-                String newestOffset = String.valueOf(entry.getValue().size());
-                String upcomingOffset = String.valueOf(entry.getValue().size() 
+ 1);
+                List<IncomingMessageEnvelope> messages = entry.getValue();
+                String oldestOffset = messages.isEmpty() ? null : "0";
 
 Review comment:
   `SystemStreamMetadata.SystemStreamPartitionMetadata.getOldestOffset` is 
documented with "A null value means the stream is empty". That's why I used 
`null` here. Does that mean that Kafka is not following the API?

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


With regards,
Apache Git Services

Reply via email to