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_r295086283
 
 

 ##########
 File path: 
samza-core/src/main/scala/org/apache/samza/storage/ContainerStorageManager.java
 ##########
 @@ -705,43 +714,42 @@ public void run() {
     this.sideInputSystemConsumers.start();
 
     // create a thread for sideInput reads
-    Thread readSideInputs = new Thread(() -> {
-        while (!shutDownSideInputRead) {
-          IncomingMessageEnvelope envelope = 
sideInputSystemConsumers.choose(true);
-          if (envelope != null) {
-
-            if (!envelope.isEndOfStream())
-              
sideInputStorageManagers.get(envelope.getSystemStreamPartition()).process(envelope);
+    Thread readSideInputsThread = new Thread(() -> {
+        try {
+          while (!shutDownSideInputRead) {
+            IncomingMessageEnvelope envelope = 
sideInputSystemConsumers.choose(true);
+            if (envelope != null) {
 
-            checkSideInputCaughtUp(envelope.getSystemStreamPartition(), 
envelope.getOffset(),
-                SystemStreamMetadata.OffsetType.NEWEST, 
envelope.isEndOfStream());
+              if (!envelope.isEndOfStream())
+                
sideInputStorageManagers.get(envelope.getSystemStreamPartition()).process(envelope);
 
-          } else {
-            LOG.trace("No incoming message was available");
+              checkSideInputCaughtUp(envelope.getSystemStreamPartition(), 
envelope.getOffset(),
 
 Review comment:
   not necessarily in this PR but should re-factor checkSideInputCaughtup since 
it's extremely complex.
   
   a few thoughts on this:
   - should return a boolean from the API
   - too many params that are un-related (eg: a few fields from envelope and an 
offset-type)
   - signature should be `boolean isCaughtUp(envelope)`
   - should surface the count-down latch mutation in a more obvious manner 
instead of happening 2 levels downstream 

----------------------------------------------------------------
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