Sanil15 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_r312302555
##########
File path:
samza-core/src/main/java/org/apache/samza/system/inmemory/InMemorySystemConsumer.java
##########
@@ -77,8 +77,19 @@ public void stop() {
*/
@Override
public void register(SystemStreamPartition systemStreamPartition, String
offset) {
- LOG.info("Registering ssp {} with starting offset {}",
systemStreamPartition, offset);
- sspToOffset.put(systemStreamPartition, offset);
+ String offsetToRegister;
+ if (offset == null) {
+ LOG.info("Registering ssp {} with starting offset null, overriding to
0", systemStreamPartition);
+ offsetToRegister = "0";
+ } else {
+ LOG.info("Registering ssp {} with starting offset {}",
systemStreamPartition, offset);
+ offsetToRegister = offset;
+ }
+ /*
+ * A null offset is the same as the beginning of the stream. Can't use
null directly since ConcurrentHashMap doesn't
Review comment:
can we also add a comment to function docs on assumption with "null" offset?
----------------------------------------------------------------
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