]> git.sur5r.net Git - openldap/commitdiff
Use UUID to generate a GID for txn_prepare. Based upon submission
authorKurt Zeilenga <kurt@openldap.org>
Mon, 11 Feb 2002 17:45:39 +0000 (17:45 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 11 Feb 2002 17:45:39 +0000 (17:45 +0000)
from Jong Hyuk Choi <jongchoi@us.ibm.com> (ITS#1585 for ITS1575).

servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/init.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/proto-bdb.h

index 185bb7ef887680ef9852d74a993094d16283bdb7..9bc57358593095fdb072037497a21420551cf343 100644 (file)
@@ -13,8 +13,6 @@
 #include "back-bdb.h"
 #include "external.h"
 
-static char bdb_gid[DB_XIDDATASIZE];
-
 int
 bdb_add(
        BackendDB       *be,
@@ -360,7 +358,12 @@ retry:     /* transaction retry */
                }
 
        } else {
-               if (( rc=TXN_PREPARE( ltid, bdb_gid )) != 0 ) {
+               char gid[DB_XIDDATASIZE];
+
+               snprintf( gid, sizeof( gid ), "%s-%08lx-%08lx",
+                       bdb_uuid, (long) op->o_connid, (long) op->o_opid );
+
+               if (( rc=TXN_PREPARE( ltid, gid )) != 0 ) {
                        text = "txn_prepare failed";
 
                } else {
index 911f23da16f54930c8f4aa68853611b174958582..9c6ca5cc58a5969533cd6be02e838a2302aa73de 100644 (file)
@@ -30,6 +30,8 @@ static struct bdbi_database {
        { NULL, NULL, 0, 0 }
 };
 
+struct berval bdb_uuid = { 0, NULL };
+
 static int
 bdb_open( BackendInfo *bi )
 {
@@ -40,6 +42,8 @@ bdb_open( BackendInfo *bi )
                NULL
        };
 
+       bi->bi_controls = controls;
+
        /* initialize the underlying database system */
        Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
                0, 0, 0 );
@@ -70,7 +74,13 @@ bdb_open( BackendInfo *bi )
 
        db_env_set_func_yield( ldap_pvt_thread_yield );
 
-       bi->bi_controls = controls;
+       {
+               static char uuidbuf[40];
+
+               bdb_uuid.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ));
+               bdb_uuid.bv_val = uuidbuf;
+       }
+
        return 0;
 }
 
index d6883865c4c8b1a131135464e61f9e75f9d9b67a..64e5ad2e286046fdf7cc2f02aaba2976fc99bcb6 100644 (file)
@@ -13,8 +13,6 @@
 #include "back-bdb.h"
 #include "external.h"
 
-static char bdb_gid[DB_XIDDATASIZE];
-
 int
 bdb_modrdn(
        Backend *be,
@@ -631,7 +629,12 @@ retry:     /* transaction retry */
                }
 
        } else {
-               if(( rc=TXN_PREPARE( ltid, bdb_gid )) != 0 ) {
+               char gid[DB_XIDDATASIZE];
+
+               snprintf( gid, sizeof( gid ), "%s-%08lx-%08lx",
+                       bdb_uuid, (long) op->o_connid, (long) op->o_opid );
+
+               if(( rc=TXN_PREPARE( ltid, gid )) != 0 ) {
                        text = "txn_prepare failed";
                } else {
                        if( bdb_cache_update_entry(&bdb->bi_cache, e) == -1 ) {
index 86d7e1bf5d5b2c2d0723e086eb1588fa6c87c4a8..d29256860e050e0b53fffc09a1fb411ff8c5addd 100644 (file)
@@ -244,6 +244,11 @@ int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t,
 #define bdb_index_entry_del(be,t,e,ap) \
        bdb_index_entry((be),(t),SLAP_INDEX_DELETE_OP,(e),(ap))
 
+/*
+ * init.c
+ */
+extern struct berval bdb_uuid;
+
 /*
  * key.c
  */