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 2 of 7] CA-34933: do not gc intrapool sessions

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH 2 of 7] CA-34933: do not gc intrapool sessions
From: Marcus Granado <marcus.granado@xxxxxxxxxx>
Date: Fri, 21 May 2010 14:46:05 +0100
Delivery-date: Fri, 21 May 2010 06:58:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1274449563@localhost>
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>
References: <patchbomb.1274449563@localhost>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
 ocaml/xapi/db_gc.ml |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1274449016 -3600
# Node ID d14022d7376eae45eb056c5c9caa61eadb883358
# Parent  96d378af31d020fa0b3a961fbe6904618254de6d
CA-34933: do not gc intrapool sessions

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

diff -r 96d378af31d0 -r d14022d7376e ocaml/xapi/db_gc.ml
--- a/ocaml/xapi/db_gc.ml
+++ b/ocaml/xapi/db_gc.ml
@@ -205,11 +205,13 @@
 
 let timeout_sessions ~__context =
   let all_sessions = Db.Session.get_internal_records_where ~__context 
~expr:Db_filter_types.True in
+  let not_intrapool_sessions = List.filter (fun (_, y) -> not 
y.Db_actions.session_pool) all_sessions in
+  let disposable_sessions = not_intrapool_sessions in
   (* Only keep a list of (ref, last_active, uuid) *)
-  let all_sessions = List.map (fun (x, y) -> x, Date.to_float 
y.Db_actions.session_last_active, y.Db_actions.session_uuid) all_sessions in
+  let disposable_sessions = List.map (fun (x, y) -> x, Date.to_float 
y.Db_actions.session_last_active, y.Db_actions.session_uuid) 
disposable_sessions in
   (* Definitely invalidate sessions last used long ago *)
   let threshold_time = Unix.time () -. Xapi_globs.inactive_session_timeout in
-  let young, old = List.partition (fun (_, y, _) -> y > threshold_time) 
all_sessions in
+  let young, old = List.partition (fun (_, y, _) -> y > threshold_time) 
disposable_sessions in
   (* If there are too many young sessions then we need to delete the oldest *)
   let lucky, unlucky = 
     if List.length young <= Xapi_globs.max_sessions
@@ -225,7 +227,7 @@
         ) sessions in
   (* Only the 'lucky' survive: the 'old' and 'unlucky' are destroyed *)
   if unlucky <> [] 
-  then debug "Number of sessions in database (%d) exceeds limit (%d): will 
delete the oldest" (List.length all_sessions) Xapi_globs.max_sessions;
+  then debug "Number of disposable sessions in database (%d/%d) exceeds limit 
(%d): will delete the oldest" (List.length disposable_sessions) (List.length 
all_sessions) Xapi_globs.max_sessions;
   cancel "Timed out session because of its age" old;
   cancel "Timed out session because max number of sessions was exceeded" 
unlucky
 

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

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api