rayman7718 commented on a change in pull request #1580:
URL: https://github.com/apache/samza/pull/1580#discussion_r797233568



##########
File path: samza-core/src/main/java/org/apache/samza/container/RunLoop.java
##########
@@ -239,8 +258,29 @@ private void runTasks(IncomingMessageEnvelope envelope) {
     if (!shutdownNow) {
       if (envelope != null) {
         PendingEnvelope pendingEnvelope = new PendingEnvelope(envelope);
-        for (AsyncTaskWorker worker : 
sspToTaskWorkerMapping.get(envelope.getSystemStreamPartition())) {
-          worker.state.insertEnvelope(pendingEnvelope);
+        SystemStreamPartition sspOfEnvelope = null;
+        // when elasticity is enabled
+        // the tasks actually consume a keyBucket of the ssp.
+        // hence use the SSP with keybucket to find the worker(s) for the 
envelope
+        if (elasticityFactor <= 1) {
+          sspOfEnvelope = envelope.getSystemStreamPartition();
+        } else {
+          sspOfEnvelope = envelope.getSystemStreamPartition(elasticityFactor);
+          log.trace("elasticity enabled. using the ssp of the envelope as {}", 
sspOfEnvelope);
+        }

Review comment:
       Cant this be one call, so that 
   envelope.getSSP(elasticity) returns the current enevelope.getSSP() with 
elasticity = 1, 
   that way method, 
   envelope.getSSP() can be deleted?




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to