You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2020/04/26 12:12:38 UTC

[GitHub] [samza] mynameborat commented on a change in pull request #1345: SAMZA-2506: Inconsistent end of stream semantics in SystemStreamPartitionMetadata

mynameborat commented on a change in pull request #1345:
URL: https://github.com/apache/samza/pull/1345#discussion_r415295705



##########
File path: samza-core/src/main/java/org/apache/samza/system/inmemory/InMemoryManager.java
##########
@@ -181,12 +181,26 @@ private SystemStreamMetadata constructSystemStreamMetadata(
             .stream()
             .collect(Collectors.toMap(entry -> entry.getKey().getPartition(), entry -> {
                 List<IncomingMessageEnvelope> messages = entry.getValue();
-                String oldestOffset = messages.isEmpty() ? null : "0";
-                String newestOffset = messages.isEmpty() ? null : String.valueOf(messages.size() - 1);
-                String upcomingOffset = String.valueOf(messages.size());
-
-                return new SystemStreamMetadata.SystemStreamPartitionMetadata(oldestOffset, newestOffset, upcomingOffset);
-
+                Integer oldestOffset = null;
+                Integer newestOffset = null;
+                int upcomingOffset = 0;

Review comment:
       maybe simplify this to have it default to original values `0, messages.size() - 1, messages.size` and only modify in case of the last message being end of stream?




----------------------------------------------------------------
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:
users@infra.apache.org