[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-directory-commits
Subject:    [389-commits] ldap/servers
From:       Mark Reynolds <mreynolds () fedoraproject ! org>
Date:       2013-06-21 19:14:45
Message-ID: 20130621191445.A451C60F4C () fedorahosted ! org
[Download RAW message or body]

 ldap/servers/slapd/backend.c      |   26 +++++++++++++++++++++-----
 ldap/servers/slapd/slapi-plugin.h |    2 ++
 2 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 8879ed2efa48e96f2b920a3ab83036b07e3b3ae4
Author: Mark Reynolds <mreynolds@redhat.com>
Date:   Fri Jun 21 10:47:09 2013 -0400

    Ticket 47329 - Improve slapi_back_transaction_begin() return code when transactions are not available
    
        Bug Description:  The slapi_back_transaction_begin() function needs it's return codes
                          to be changed to be more friendly for plug-in writers when
                          transactions are not available.
    
        Fix Description:  Added new error code SLAPI_BACK_TRANSACTION_NOT_SUPPORTED, and
                          updated the slapi_plugin.h
    
        https://fedorahosted.org/389/ticket/47329
    
        Reviewed by: Noriko, Ludwig, and Rich(Thanks!!!)

diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
index ad253f1..ead251e 100644
--- a/ldap/servers/slapd/backend.c
+++ b/ldap/servers/slapd/backend.c
@@ -648,8 +648,13 @@ int
 slapi_back_transaction_begin(Slapi_PBlock *pb)
 {
     IFP txn_begin;
-    slapi_pblock_get(pb, SLAPI_PLUGIN_DB_BEGIN_FN, (void*)&txn_begin);
-    return txn_begin(pb);
+    if(slapi_pblock_get(pb, SLAPI_PLUGIN_DB_BEGIN_FN, (void*)&txn_begin) ||
+       !txn_begin)
+    {
+        return SLAPI_BACK_TRANSACTION_NOT_SUPPORTED;
+    } else {
+        return txn_begin(pb);
+    }
 }
 
 /* API to expose DB transaction commit */
@@ -657,7 +662,13 @@ int
 slapi_back_transaction_commit(Slapi_PBlock *pb)
 {
     IFP txn_commit;
-    slapi_pblock_get(pb, SLAPI_PLUGIN_DB_COMMIT_FN, (void*)&txn_commit);
+    if(slapi_pblock_get(pb, SLAPI_PLUGIN_DB_COMMIT_FN, (void*)&txn_commit) ||
+        !txn_commit)
+    {
+        return SLAPI_BACK_TRANSACTION_NOT_SUPPORTED;
+    } else {
+        return txn_commit(pb);
+    }
     return txn_commit(pb);
 }
 
@@ -666,6 +677,11 @@ int
 slapi_back_transaction_abort(Slapi_PBlock *pb)
 {
     IFP txn_abort;
-    slapi_pblock_get(pb, SLAPI_PLUGIN_DB_ABORT_FN, (void*)&txn_abort);
-    return txn_abort(pb);
+    if(slapi_pblock_get(pb, SLAPI_PLUGIN_DB_ABORT_FN, (void*)&txn_abort) ||
+        !txn_abort)
+    {
+        return SLAPI_BACK_TRANSACTION_NOT_SUPPORTED;
+    } else {
+        return txn_abort(pb);
+    }
 }
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index d7d968d..d1e90de 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6061,6 +6061,7 @@ const char * slapi_be_gettype(Slapi_Backend *be);
  *
  * \param pb Pblock which is supposed to set (Slapi_Backend *) to SLAPI_BACKEND
  * \return 0 if successful
+ * \return SLAPI_BACK_TRANSACTION_NOT_SUPPORTED if transaction support is not available for this backend
  * \return Non-zero if an error occurred
  *
  * \see slapi_back_transaction_commit
@@ -6908,6 +6909,7 @@ typedef struct slapi_plugindesc {
 #define SLAPI_PARENT_TXN			190
 #define SLAPI_TXN				191
 #define SLAPI_TXN_RUV_MODS_FN			1901
+#define SLAPI_BACK_TRANSACTION_NOT_SUPPORTED	1902
 
 /*
  * The following are used to pass information back and forth


--
389 commits mailing list
389-commits@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic