[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. ca4e28a2d1d8d9cabc28b68e943806d4527114ca

Evergreen Git git at git.evergreen-ils.org
Wed Nov 5 10:08:59 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  ca4e28a2d1d8d9cabc28b68e943806d4527114ca (commit)
      from  3249d64a7c79ca30cd58dc85dfa6aa5878306683 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ca4e28a2d1d8d9cabc28b68e943806d4527114ca
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Oct 20 22:55:20 2014 -0400

    LP#1366964 Update libdbi connection test error parsing
    
    Modern version of libdbi return a slightly different error message for
    queries which fail mid-transaction, causing an C-based DB backends to
    exit abruptly unnecessarily.  Update the error message test to include
    the new format.
    
    Includes Perl live test for confirming functionality.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c
index d29c6f2..9cf6591 100644
--- a/Open-ILS/src/c-apps/oils_sql.c
+++ b/Open-ILS/src/c-apps/oils_sql.c
@@ -272,8 +272,12 @@ int oilsIsDBConnected( dbi_conn handle ) {
 			"ignored until end of transaction block\n";
 		const char* msg;
 		dbi_conn_error( handle, &msg );
-		if( strcmp( msg, ok_msg )) {
-			osrfLogError( OSRF_LOG_MARK, "Database connection isn't working" );
+		// Newer versions of dbi_conn_error return codes within the error msg.
+		// E.g. 3624914: ERROR:  current transaction is aborted, commands ignored until end of transaction block
+		// Substring test should work regardless.
+		const char* substr = strstr(msg, ok_msg);
+		if( substr == NULL ) {
+			osrfLogError( OSRF_LOG_MARK, "Database connection isn't working : %s", msg );
 			return 0;
 		} else
 			return 1;   // ignoring SELECT due to previous error; that's okay
diff --git a/Open-ILS/src/perlmods/live_t/08-lp1366964-libdbi-error.t b/Open-ILS/src/perlmods/live_t/08-lp1366964-libdbi-error.t
new file mode 100644
index 0000000..3164a6c
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/08-lp1366964-libdbi-error.t
@@ -0,0 +1,39 @@
+#!perl
+
+use Test::More tests => 2;
+
+diag("Tests libdbi transaction error reporting");
+
+use strict; use warnings;
+
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::CStoreEditor (':funcs');
+use OpenILS::Utils::Fieldmapper;
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+my $e = new_editor(xact => 1);
+$e->init;
+
+# create a copy status object with ID 1, which will fail.
+my $stat = Fieldmapper::config::copy_status->new;
+$stat->id(1);
+
+# when functioning well, this should happen and fail quickly
+my $start = time;
+$e->create_config_copy_status($stat);
+my $evt = $e->die_event; # this part takes the longest
+my $duration = time - $start;
+
+cmp_ok($duration, '<', '10', 
+    'Confirm cstore reports standard query error in a timely fashion');
+
+if ($evt) {
+    is($evt->{textcode}, 'DATABASE_QUERY_FAILED',
+        'CStoreEditor returns standard query error');
+} else {
+    fail('CStoreEditor returned no event');
+}
+
+
+

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/c-apps/oils_sql.c                     |    8 +++-
 .../perlmods/live_t/08-lp1366964-libdbi-error.t    |   39 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 Open-ILS/src/perlmods/live_t/08-lp1366964-libdbi-error.t


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list