You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2020/07/22 20:34:43 UTC

[qpid-dispatch] branch master updated: DISPTACH-1708: fallback dest releases phase 0 msgs received by fallback

This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new a383172  DISPTACH-1708: fallback dest releases phase 0 msgs received by fallback
a383172 is described below

commit a38317212d5ab54742a44c9b376bfa1fe75aae37
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Wed Jul 22 16:08:56 2020 -0400

    DISPTACH-1708: fallback dest releases phase 0 msgs received by fallback
    
    Add count of those released messages.
    
    This closes #775
---
 tests/system_tests_fallback_dest.py | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/tests/system_tests_fallback_dest.py b/tests/system_tests_fallback_dest.py
index 2771144..c70c226 100644
--- a/tests/system_tests_fallback_dest.py
+++ b/tests/system_tests_fallback_dest.py
@@ -589,9 +589,11 @@ class SwitchoverTest(MessagingHandler):
         self.n_rel          = 0
         self.phase          = 0
         self.tx_seq         = 0
+        self.local_rel      = 0
 
     def timeout(self):
-        self.error = "Timeout Expired - n_tx=%d, n_rx=%d, n_rel=%d, phase=%d" % (self.n_tx, self.n_rx, self.n_rel, self.phase)
+        self.error = "Timeout Expired - n_tx=%d, n_rx=%d, n_rel=%d, phase=%d, local_rel=%d" % \
+                     (self.n_tx, self.n_rx, self.n_rel, self.phase, self.local_rel)
         self.sender_conn.close()
         self.primary_conn.close()
         self.fallback_conn.close()
@@ -633,13 +635,23 @@ class SwitchoverTest(MessagingHandler):
             self.send()
 
     def on_message(self, event):
-        self.n_rx += 1
-        if self.n_rx == self.count:
-            if self.phase == 0:
-                self.phase = 1
-                self.primary_receiver.close()
-            else:
-                self.fail(None)
+        if not (self.phase == 0 and event.receiver == self.fallback_receiver):
+            # Phase 0 message over primary receiver. Phase 1 can come in only on primary.
+            self.n_rx += 1
+            if self.n_rx == self.count:
+                if self.phase == 0:
+                    self.phase = 1
+                    self.primary_receiver.close()
+                else:
+                    self.fail(None)
+        else:
+            # Phase 0 message over fallback receiver. This may happen because
+            # primary receiver is on a distant router and the fallback receiver is local.
+            # Release the message to keep trying until the primary receiver kicks in.
+            self.release(event.delivery)
+            self.n_rel += 1
+            self.n_tx -= 1
+            self.local_rel += 1
 
     def on_released(self, event):
         self.n_rel += 1


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org