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 1 of 3] Temporarily revert c/s 594:41501bb83b18 (sessio

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 1 of 3] Temporarily revert c/s 594:41501bb83b18 (session caching stuff)
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 28 Jan 2010 16:33:47 +0000
Delivery-date: Thu, 28 Jan 2010 08:27:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1264696426@xxxxxxxxxxxxxxxxxxxx>
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 David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1264696398 0
# Node ID 788a15f7eb8618501b754ffdf789c68b24ed40b0
# Parent  22cd3f304b9e0818b80ac5a40e6d4c6438c5e58a
Temporarily revert c/s 594:41501bb83b18 (session caching stuff)

diff -r 22cd3f304b9e -r 788a15f7eb86 ocaml/xapi/db_gc.ml
--- a/ocaml/xapi/db_gc.ml       Thu Jan 21 15:45:09 2010 +0000
+++ b/ocaml/xapi/db_gc.ml       Thu Jan 28 16:33:18 2010 +0000
@@ -205,15 +205,11 @@
 
 let timeout_sessions ~__context =
   let all_sessions = Db.Session.get_internal_records_where ~__context 
~expr:Db_filter_types.True in
-  let external_sessions = List.filter (fun (_, y) -> not 
y.Db_actions.session_pool) all_sessions in
-  let unused_sessions = List.filter
-    (fun (_, y) -> List.for_all (fun t -> Db.Task.get_status ~__context 
~self:t <> `Pending) y.Db_actions.session_tasks
-    ) external_sessions in
   (* Only keep a list of (ref, last_active, uuid) *)
-  let unused_sessions = List.map (fun (x, y) -> x, Date.to_float 
y.Db_actions.session_last_active, y.Db_actions.session_uuid) unused_sessions in
+  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
   (* 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) 
unused_sessions in
+  let young, old = List.partition (fun (_, y, _) -> y > threshold_time) 
all_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
@@ -229,8 +225,7 @@
         ) sessions in
   (* Only the 'lucky' survive: the 'old' and 'unlucky' are destroyed *)
   if unlucky <> [] 
-  then debug "Number of unused sessions in database (%d/%d) exceeds limit 
(%d): will delete the oldest"
-     (List.length unused_sessions) (List.length all_sessions) 
Xapi_globs.max_sessions;
+  then debug "Number of sessions in database (%d) exceeds limit (%d): will 
delete the oldest" (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
 
1 file changed, 3 insertions(+), 8 deletions(-)
ocaml/xapi/db_gc.ml |   11 +++--------


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

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