andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 4 months ago
Clone
Blob Blame History Raw
From 23d6934151c88827ed4bb5cce961160f8a43b110 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Wed, 24 Apr 2013 11:44:40 -0600
Subject: [PATCH 129/225] Ticket #47348 - add etimes to per second/minute stats

https://fedorahosted.org/389/ticket/47348
Reviewed by: mreynolds (Thanks!)
Branch: 389-ds-base-1.3.1
Fix Description: Add an "ElapsedTime" column to the -m/-M output.  This column
is the cumulative etimes of all operations during that time period.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: yes
(cherry picked from commit 9813b219ad2aa7b7194d9295dd529e12889a8534)

Ticket #47349 - DS instance crashes under a high load

https://fedorahosted.org/389/ticket/47349
Reviewed by: nkinder (Thanks!)
Branch: 389-ds-base-1.3.1
Fix Description: handle_new_connection initializes the connection object,
then calls connection_table_move_connection_on_to_active_list to put it
on the list of active connections, then unlocks the c_mutex, then calls
connection_new_private to allocate c_private.  If another thread
interrupts after the conn has been moved to the active list, but before
c_private has been allocated, the new conn will be available via
connection_table_iterate_active_connections where table_iterate_function
will attempt to dereference the NULL c_private.
The fix is to move connection_new_private inside the c_mutex lock, and to
move connection_table_move_connection_on_to_active_list to be the very last
thing before releasing the c_mutex lock.  Once the conn is on the active
list it is live and we cannot do anything else to it.
Note: I have still not been able to reproduce the problem in a non-debug
optimized build.
Platforms tested: RHEL6 x86_64
Note: Before patch, server would crash within 5 minutes.  After patch, server
has been running for several days in customer environment.
Flag Day: no
Doc impact: no
(cherry picked from commit 05d209432571dc64b242ae47113ae4cbb43607d2)
(cherry picked from commit c7fc203ffe09809e430ff1217ec352db95d636a0)
(cherry picked from commit 02a70f7e8f3bf5deac9039b51c31a206e628e9e1)
(cherry picked from commit 5510e70ddf9720311e23641d903b471051789575)
---
 ldap/admin/src/logconv.pl | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index 3b8adc5..efc5970 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -2042,7 +2042,7 @@ sub parseLineNormal
 		if ($1 ne "0"){ $errorCount++;}
 		else { $successCount++;}
 	}
-	if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1);}
+	if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1); inc_stats_val('etime',$1,$s_stats,$m_stats); }
 	if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){
 		if ($_ =~ / nentries= *([0-9]+)/i ){ writeFile($NENTRIES, $1); }
 	}
@@ -2197,6 +2197,7 @@ reset_stats_block
     $stats->{'anonbind'}=0;
     $stats->{'unbind'}=0;
     $stats->{'notesu'}=0;
+    $stats->{'etime'}=0;
     return;
 }
 
@@ -2241,12 +2242,13 @@ print_stats_block
 					    $stats->{'bind'},
 					    $stats->{'anonbind'},
 					    $stats->{'unbind'},
-					    $stats->{'notesu'} ),
+					    $stats->{'notesu'},
+					    $stats->{'etime'}),
 			    		"\n" );
 			} else {
 				$stats->{'fh'}->print(
 			    		"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
-			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed\n"
+			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed,ElapsedTime\n"
 			    	);
 			}
 		}
@@ -2265,6 +2267,20 @@ inc_stats
 	return;
 }
 
+# like inc_stats, but increments the block counter with the given value e.g.
+# 'statname1', val, statblock1, statblock2, ...
+sub
+inc_stats_val
+{
+	my $n = shift;
+	my $val = shift;
+	foreach(@_){
+		$_->{$n} += $val
+	    	if exists $_->{$n};
+	}
+	return;
+}
+
 sub
 displayBindReport
 {
-- 
1.8.1.4