[389-ds-base/el5] Ticket #331 - transaction errors with db 4.3 and db 4.2

Richard Allen Megginson rmeggins at fedoraproject.org
Thu Mar 29 19:10:28 UTC 2012


commit 4bc6090f3e9d14b2b72571f93efeef7c48aa3c24
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Thu Mar 29 13:05:37 2012 -0600

    Ticket #331 - transaction errors with db 4.3 and db 4.2
    
    Ticket #331 - transaction errors with db 4.3 and db 4.2

 ...transaction-errors-with-db-4.3-and-db-4.2.patch |  100 ++++++++++++++++++++
 389-ds-base.spec                                   |    7 +-
 2 files changed, 106 insertions(+), 1 deletions(-)
---
diff --git a/0001-Ticket-331-transaction-errors-with-db-4.3-and-db-4.2.patch b/0001-Ticket-331-transaction-errors-with-db-4.3-and-db-4.2.patch
new file mode 100644
index 0000000..fb995c6
--- /dev/null
+++ b/0001-Ticket-331-transaction-errors-with-db-4.3-and-db-4.2.patch
@@ -0,0 +1,100 @@
+From 9c7e9d51309cb8daa900a3e37c56267477aa666d Mon Sep 17 00:00:00 2001
+From: Rich Megginson <rmeggins at redhat.com>
+Date: Wed, 28 Mar 2012 16:11:20 -0600
+Subject: [PATCH] Ticket #331 - transaction errors with db 4.3 and db 4.2
+
+https://fedorahosted.org/389/ticket/331
+Resolves: Ticket #331
+Bug Description: transaction errors with db 4.3 and db 4.2
+Reviewed by: nhosoi (Thanks!)
+Branch: master
+Fix Description:
+we are enabling transactions everywhere - since we are opening databases
+with DB_AUTO_COMMIT we must either open and pass a valid txn handle to
+all operations that modify the database (put, del) or we must pass the
+DB_AUTO_COMMIT flag to those operations.
+Platforms tested: RHEL6 x86_64, RHEL5 i386
+Flag Day: no
+Doc impact: no
+---
+ ldap/servers/plugins/replication/cl5_api.c |   22 +++++++++++++++-------
+ 1 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
+index 3c02d41..2b57f91 100644
+--- a/ldap/servers/plugins/replication/cl5_api.c
++++ b/ldap/servers/plugins/replication/cl5_api.c
+@@ -95,7 +95,15 @@
+ #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
+ #define USE_DB_TXN 1 /* use transactions */
+ #define DEFAULT_DB_ENV_OP_FLAGS DB_AUTO_COMMIT
+-#define DEFAULT_DB_OP_FLAGS 0
++#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR <= 4300
++/* we are enabling transactions everywhere - since we are opening databases
++   with DB_AUTO_COMMIT we must either open and pass a valid txn handle to
++   all operations that modify the database (put, del) or we must pass the
++   DB_AUTO_COMMIT flag to those operations */
++#define DEFAULT_DB_OP_FLAGS(txn) (txn ? 0 : DB_AUTO_COMMIT)
++#else
++#define DEFAULT_DB_OP_FLAGS(txn) 0
++#endif
+ #define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)    \
+ {                                                                              \
+ 	if (((oflags) & DB_INIT_TXN) && ((oflags) & DB_INIT_LOG))                  \
+@@ -108,7 +116,7 @@
+ 	}                                                                          \
+ }
+ #else /* older then db 41 */
+-#define DEFAULT_DB_OP_FLAGS 0
++#define DEFAULT_DB_OP_FLAGS(txn) 0
+ #define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)    \
+ 	(rval) = (db)->open((db), (file), (database), (type), (flags), (mode))
+ #endif
+@@ -3676,7 +3684,7 @@ static int _cl5ReadRUV (const char *replGen, Object *obj, PRBool purge)
+ 
+                             /* delete the entry; it is re-added when file
+ 							   is successfully closed */
+-							file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS);
++							file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS(NULL));
+ 							
+ 							rc = CL5_SUCCESS;
+ 							goto done;
+@@ -3747,7 +3755,7 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
+ 		return CL5_DB_ERROR;
+ 	}
+ #endif
+-	rc = file->db->put(file->db, txnid, &key, &data, DEFAULT_DB_OP_FLAGS);
++	rc = file->db->put(file->db, txnid, &key, &data, DEFAULT_DB_OP_FLAGS(txnid));
+ 
+ 	slapi_ch_free (&(data.data));
+ 	if ( rc == 0 )
+@@ -4039,7 +4047,7 @@ static int _cl5GetEntryCount (CL5DBFile *file)
+ 
+ 							/* delete the entry. the entry is re-added when file
+ 							   is successfully closed */
+-							file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS);
++							file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS(NULL));
+                             slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
+ 									"_cl5GetEntryCount: %d changes for replica %s\n", 
+                                     file->entryCount, file->replName);
+@@ -4103,7 +4111,7 @@ static int _cl5WriteEntryCount (CL5DBFile *file)
+ 		return CL5_DB_ERROR;
+ 	}
+ #endif
+-	rc = file->db->put(file->db, txnid, &key, &data, DEFAULT_DB_OP_FLAGS);
++	rc = file->db->put(file->db, txnid, &key, &data, DEFAULT_DB_OP_FLAGS(txnid));
+ 	if (rc == 0)
+ 	{
+ #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
+@@ -4599,7 +4607,7 @@ static int _cl5WriteOperationTxn(const char *replName, const char *replGen,
+ 		{
+ 			PR_WaitSemaphore(file->sema);
+ 		}
+-		rc = file->db->put(file->db, txnid, &key, data, DEFAULT_DB_OP_FLAGS);
++		rc = file->db->put(file->db, txnid, &key, data, DEFAULT_DB_OP_FLAGS(txnid));
+ 		if ( file->sema )
+ 		{
+ 			PR_PostSemaphore(file->sema);
+-- 
+1.7.1
+
diff --git a/389-ds-base.spec b/389-ds-base.spec
index 086d71b..55a57f2 100644
--- a/389-ds-base.spec
+++ b/389-ds-base.spec
@@ -18,7 +18,7 @@
 Summary:          389 Directory Server (base)
 Name:             389-ds-base
 Version:          1.2.10.4
-Release:          %{?relprefix}2%{?prerel}%{?dist}
+Release:          %{?relprefix}3%{?prerel}%{?dist}
 License:          GPLv2 with exceptions
 URL:              http://port389.org/
 Group:            System Environment/Daemons
@@ -103,6 +103,7 @@ Source0:          http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz
 # 389-ds-git.sh should be used to generate the source tarball from git
 Source1:          %{name}-git.sh
 Source2:          %{name}-devel.README
+Patch0:           0001-Ticket-331-transaction-errors-with-db-4.3-and-db-4.2.patch
 
 %description
 389 Directory Server is an LDAPv3 compliant server.  The base package includes
@@ -159,6 +160,7 @@ SELinux policy interface for the 389 Directory Server base package.
 %prep
 %setup -q -n %{name}-%{version}%{?prerel}
 cp %{SOURCE2} README.devel
+%patch0 -p1
 
 %build
 %if %{use_openldap}
@@ -348,6 +350,9 @@ exit 0
 %{_libdir}/%{pkgname}/libslapd.so.*
 
 %changelog
+* Wed Mar 28 2012 Rich Megginson <rmeggins at redhat.com> - 1.2.10.4-3
+- Ticket #331 - transaction errors with db 4.3 and db 4.2
+
 * Tue Mar 13 2012 Rich Megginson <rmeggins at redhat.com> - 1.2.10.4-2
 - rebuild
 


More information about the scm-commits mailing list