vjagadish1989 commented on a change in pull request #1086: SAMZA-2256:
Hotstandby fix for exception while reading side inputs
URL: https://github.com/apache/samza/pull/1086#discussion_r295077506
##########
File path:
samza-core/src/main/java/org/apache/samza/storage/TaskSideInputStorageManager.java
##########
@@ -215,7 +211,17 @@ public synchronized void process(IncomingMessageEnvelope
message) {
KeyValueStore keyValueStore = (KeyValueStore) stores.get(storeName);
Collection<Entry<?, ?>> entriesToBeWritten =
sideInputsProcessor.process(message, keyValueStore);
- keyValueStore.putAll(ImmutableList.copyOf(entriesToBeWritten));
+
+ // Iterate over the list to be written.
+ // TODO: SAMZA-2255: Optimize value writes in TaskSideInputStorageManager
+ for (Entry entry : entriesToBeWritten) {
+ // If the key is null we ignore, if the value is null, we issue a
delete, else we issue a put
Review comment:
Slightly cleaner to structure this as below so that it's more obvious that
"null keys" get skipped
```
if (key != null) {
if (value != null) {
store.put(key, value);
} else {
store.delete(key);
}
}
```
----------------------------------------------------------------
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