From 881b244acea5bf62f9905446df41f9a5c6ab5110 Mon Sep 17 00:00:00 2001 From: Ira Cooper Date: Mon, 22 Aug 2011 12:46:41 -0700 Subject: [PATCH] Fix bug #8395 - optimize serverid_exists() for Solaris. jra asked: Do you have any idea on how many calls it saves, and what help the optimization gives ? As far as calls: Not 100% sure, dtrace pointed the issue out to me, and when I saw 10-50%(Or more), I looked for an easy fix. The real expense here is the fnctl locks on the database. That's pretty painful. 1000ns per call, and probably 3-4 calls in that chain. So it doesn't take much to come out ahead was my math. --- source3/lib/serverid.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index b1f6a57..8cd7f5a 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -233,7 +233,11 @@ bool serverid_exists(const struct server_id *id) struct serverid_key key; TDB_DATA tdbkey; - if (lp_clustering() && !process_exists(*id)) { + if (procid_is_me(id)) { + return true; + } + + if (!process_exists(*id)) { return false; } -- 1.7.3.1