prateekm 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_r323481794
##########
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:
@cameronlee314 Any objection to defaulting this to "0" instead of null in
case the SSP is empty? This is consistent with the behavior for Kafka as well
where an empty SSP returns (0, null, 0) as (oldest, newest, upcoming) offsets.
Will also remove the need to handle nulls in Consumer#register.
----------------------------------------------------------------
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