Use UUID to generate a GID for txn_prepare. Based upon submission

from Jong Hyuk Choi <jongchoi@us.ibm.com> (ITS#1585 for ITS1575).
This commit is contained in:
Kurt Zeilenga 2002-02-11 17:45:39 +00:00
parent 4554557171
commit 488862105f
4 changed files with 28 additions and 7 deletions

View 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 {

View 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;
}

View 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 ) {

View 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
*/