WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] CA-36633: backoff delay when retrying master connectio

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] CA-36633: backoff delay when retrying master connection
From: Marcus Granado <marcus.granado@xxxxxxxxxx>
Date: Wed, 17 Feb 2010 17:19:04 +0000
Delivery-date: Wed, 17 Feb 2010 09:18:46 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1266426911 0
# Node ID 87b760a0d42c2182afaec305c5cb437540832fbc
# Parent  6d66c87993de600782428fecd670a43c8d67601e
CA-36633: backoff delay when retrying master connection

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

diff -r 6d66c87993de -r 87b760a0d42c ocaml/database/master_connection.ml
--- a/ocaml/database/master_connection.ml       Wed Feb 17 17:15:11 2010 +0000
+++ b/ocaml/database/master_connection.ml       Wed Feb 17 17:15:11 2010 +0000
@@ -112,6 +112,12 @@
   let write_ok = ref false in
   let result = ref (Xml.PCData "") in
   let surpress_no_timeout_logs = ref false in
+  let backoff_delay = ref 2.0 in (* initial delay = 2s *)
+  let update_backoff_delay () =
+    backoff_delay := !backoff_delay *. 2.0;
+    if !backoff_delay < 2.0 then backoff_delay := 2.0 
+    else if !backoff_delay > 256.0 then backoff_delay := 256.0
+  in  
   while (not !write_ok)
   do
     begin
@@ -175,7 +181,9 @@
                    raise Cannot_connect_to_master
                  end
              end;
-           Thread.delay 2.0;
+           debug "Sleeping %f seconds before retrying master connection..." 
!backoff_delay;
+           Thread.delay !backoff_delay;
+           update_backoff_delay ();
            try
              open_secure_connection()
            with _ -> () (* oh well, maybe nextime... *)
1 file changed, 9 insertions(+), 1 deletion(-)
ocaml/database/master_connection.ml |   10 +++++++++-


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CA-36633: backoff delay when retrying master connection, Marcus Granado <=