andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 23d6934151c88827ed4bb5cce961160f8a43b110 Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Wed, 24 Apr 2013 11:44:40 -0600
dc8c34
Subject: [PATCH 129/225] Ticket #47348 - add etimes to per second/minute stats
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47348
dc8c34
Reviewed by: mreynolds (Thanks!)
dc8c34
Branch: 389-ds-base-1.3.1
dc8c34
Fix Description: Add an "ElapsedTime" column to the -m/-M output.  This column
dc8c34
is the cumulative etimes of all operations during that time period.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: yes
dc8c34
(cherry picked from commit 9813b219ad2aa7b7194d9295dd529e12889a8534)
dc8c34
dc8c34
Ticket #47349 - DS instance crashes under a high load
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47349
dc8c34
Reviewed by: nkinder (Thanks!)
dc8c34
Branch: 389-ds-base-1.3.1
dc8c34
Fix Description: handle_new_connection initializes the connection object,
dc8c34
then calls connection_table_move_connection_on_to_active_list to put it
dc8c34
on the list of active connections, then unlocks the c_mutex, then calls
dc8c34
connection_new_private to allocate c_private.  If another thread
dc8c34
interrupts after the conn has been moved to the active list, but before
dc8c34
c_private has been allocated, the new conn will be available via
dc8c34
connection_table_iterate_active_connections where table_iterate_function
dc8c34
will attempt to dereference the NULL c_private.
dc8c34
The fix is to move connection_new_private inside the c_mutex lock, and to
dc8c34
move connection_table_move_connection_on_to_active_list to be the very last
dc8c34
thing before releasing the c_mutex lock.  Once the conn is on the active
dc8c34
list it is live and we cannot do anything else to it.
dc8c34
Note: I have still not been able to reproduce the problem in a non-debug
dc8c34
optimized build.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Note: Before patch, server would crash within 5 minutes.  After patch, server
dc8c34
has been running for several days in customer environment.
dc8c34
Flag Day: no
dc8c34
Doc impact: no
dc8c34
(cherry picked from commit 05d209432571dc64b242ae47113ae4cbb43607d2)
dc8c34
(cherry picked from commit c7fc203ffe09809e430ff1217ec352db95d636a0)
dc8c34
(cherry picked from commit 02a70f7e8f3bf5deac9039b51c31a206e628e9e1)
dc8c34
(cherry picked from commit 5510e70ddf9720311e23641d903b471051789575)
dc8c34
---
dc8c34
 ldap/admin/src/logconv.pl | 22 +++++++++++++++++++---
dc8c34
 1 file changed, 19 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
dc8c34
index 3b8adc5..efc5970 100755
dc8c34
--- a/ldap/admin/src/logconv.pl
dc8c34
+++ b/ldap/admin/src/logconv.pl
dc8c34
@@ -2042,7 +2042,7 @@ sub parseLineNormal
dc8c34
 		if ($1 ne "0"){ $errorCount++;}
dc8c34
 		else { $successCount++;}
dc8c34
 	}
dc8c34
-	if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1);}
dc8c34
+	if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1); inc_stats_val('etime',$1,$s_stats,$m_stats); }
dc8c34
 	if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){
dc8c34
 		if ($_ =~ / nentries= *([0-9]+)/i ){ writeFile($NENTRIES, $1); }
dc8c34
 	}
dc8c34
@@ -2197,6 +2197,7 @@ reset_stats_block
dc8c34
     $stats->{'anonbind'}=0;
dc8c34
     $stats->{'unbind'}=0;
dc8c34
     $stats->{'notesu'}=0;
dc8c34
+    $stats->{'etime'}=0;
dc8c34
     return;
dc8c34
 }
dc8c34
 
dc8c34
@@ -2241,12 +2242,13 @@ print_stats_block
dc8c34
 					    $stats->{'bind'},
dc8c34
 					    $stats->{'anonbind'},
dc8c34
 					    $stats->{'unbind'},
dc8c34
-					    $stats->{'notesu'} ),
dc8c34
+					    $stats->{'notesu'},
dc8c34
+					    $stats->{'etime'}),
dc8c34
 			    		"\n" );
dc8c34
 			} else {
dc8c34
 				$stats->{'fh'}->print(
dc8c34
 			    		"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
dc8c34
-			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed\n"
dc8c34
+			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed,ElapsedTime\n"
dc8c34
 			    	);
dc8c34
 			}
dc8c34
 		}
dc8c34
@@ -2265,6 +2267,20 @@ inc_stats
dc8c34
 	return;
dc8c34
 }
dc8c34
 
dc8c34
+# like inc_stats, but increments the block counter with the given value e.g.
dc8c34
+# 'statname1', val, statblock1, statblock2, ...
dc8c34
+sub
dc8c34
+inc_stats_val
dc8c34
+{
dc8c34
+	my $n = shift;
dc8c34
+	my $val = shift;
dc8c34
+	foreach(@_){
dc8c34
+		$_->{$n} += $val
dc8c34
+	    	if exists $_->{$n};
dc8c34
+	}
dc8c34
+	return;
dc8c34
+}
dc8c34
+
dc8c34
 sub
dc8c34
 displayBindReport
dc8c34
 {
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34