summaryrefslogtreecommitdiff
path: root/db/txn/txn_util.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-07-16 16:48:14 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-07-16 16:48:14 +0300
commit2cfd3012bfcb5c5c61bbaf662ef084e0ab789d79 (patch)
treee12ee52087506ac8c7a5eee83b17497d98df2d40 /db/txn/txn_util.c
parentb754fe19fd387ca5fe8e7c00ddaa25c898fa192f (diff)
downloadlibrpm-tizen-2cfd3012bfcb5c5c61bbaf662ef084e0ab789d79.tar.gz
librpm-tizen-2cfd3012bfcb5c5c61bbaf662ef084e0ab789d79.tar.bz2
librpm-tizen-2cfd3012bfcb5c5c61bbaf662ef084e0ab789d79.zip
Update internal BDB to version 4.5.20
Diffstat (limited to 'db/txn/txn_util.c')
-rw-r--r--db/txn/txn_util.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/db/txn/txn_util.c b/db/txn/txn_util.c
index ff94cd7db..fea21c76f 100644
--- a/db/txn/txn_util.c
+++ b/db/txn/txn_util.c
@@ -1,22 +1,16 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2001-2004
- * Sleepycat Software. All rights reserved.
+ * Copyright (c) 2001-2006
+ * Oracle Corporation. All rights reserved.
*
- * $Id: txn_util.c,v 11.28 2004/09/16 17:55:19 margo Exp $
+ * $Id: txn_util.c,v 12.8 2006/08/24 14:46:53 bostic Exp $
*/
#include "db_config.h"
-#ifndef NO_SYSTEM_INCLUDES
-#include <sys/types.h>
-#include <string.h>
-#endif
-
#include "db_int.h"
#include "dbinc/db_page.h"
-#include "dbinc/db_shash.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
#include "dbinc/txn.h"
@@ -35,6 +29,7 @@ struct __txn_event {
/* Delayed remove. */
char *name;
u_int8_t *fileid;
+ int inmem;
} r;
struct {
/* Lock event. */
@@ -79,14 +74,15 @@ __txn_closeevent(dbenv, txn, dbp)
* Creates a remove event that can be added to the commit list.
*
* PUBLIC: int __txn_remevent __P((DB_ENV *,
- * PUBLIC: DB_TXN *, const char *, u_int8_t*));
+ * PUBLIC: DB_TXN *, const char *, u_int8_t *, int));
*/
int
-__txn_remevent(dbenv, txn, name, fileid)
+__txn_remevent(dbenv, txn, name, fileid, inmem)
DB_ENV *dbenv;
DB_TXN *txn;
const char *name;
u_int8_t *fileid;
+ int inmem;
{
int ret;
TXN_EVENT *e;
@@ -105,6 +101,7 @@ __txn_remevent(dbenv, txn, name, fileid)
memcpy(e->u.r.fileid, fileid, DB_FILE_ID_LEN);
}
+ e->u.r.inmem = inmem;
e->op = TXN_REMOVE;
TAILQ_INSERT_TAIL(&txn->events, e, links);
@@ -115,9 +112,10 @@ err: if (e != NULL)
return (ret);
}
+
/*
* __txn_remrem --
- * Remove a remove event because the remove has be superceeded,
+ * Remove a remove event because the remove has been superceeded,
* by a create of the same name, for example.
*
* PUBLIC: void __txn_remrem __P((DB_ENV *, DB_TXN *, const char *));
@@ -251,7 +249,8 @@ __txn_doevents(dbenv, txn, opcode, preprocess)
if (preprocess) {
for (e = TAILQ_FIRST(&txn->events);
e != NULL; e = TAILQ_NEXT(e, links)) {
- if (e->op != TXN_TRADE)
+ if (e->op != TXN_TRADE ||
+ IS_WRITELOCK(e->u.t.lock.mode))
continue;
DO_TRADE;
}
@@ -262,7 +261,7 @@ __txn_doevents(dbenv, txn, opcode, preprocess)
* Prepare should only cause a preprocess, since the transaction
* isn't over.
*/
- DB_ASSERT(opcode != TXN_PREPARE);
+ DB_ASSERT(dbenv, opcode != TXN_PREPARE);
while ((e = TAILQ_FIRST(&txn->events)) != NULL) {
TAILQ_REMOVE(&txn->events, e, links);
/*
@@ -277,7 +276,7 @@ __txn_doevents(dbenv, txn, opcode, preprocess)
switch (e->op) {
case TXN_CLOSE:
/* If we didn't abort this txn, we screwed up badly. */
- DB_ASSERT(opcode == TXN_ABORT);
+ DB_ASSERT(dbenv, opcode == TXN_ABORT);
if ((t_ret = __db_close(e->u.c.dbp,
NULL, DB_NOSYNC)) != 0 && ret == 0)
ret = t_ret;
@@ -285,8 +284,8 @@ __txn_doevents(dbenv, txn, opcode, preprocess)
case TXN_REMOVE:
if (e->u.r.fileid != NULL) {
if ((t_ret = __memp_nameop(dbenv,
- e->u.r.fileid,
- NULL, e->u.r.name, NULL)) != 0 && ret == 0)
+ e->u.r.fileid, NULL, e->u.r.name,
+ NULL, e->u.r.inmem)) != 0 && ret == 0)
ret = t_ret;
} else if ((t_ret =
__os_unlink(dbenv, e->u.r.name)) != 0 && ret == 0)
@@ -303,7 +302,7 @@ __txn_doevents(dbenv, txn, opcode, preprocess)
break;
default:
/* This had better never happen. */
- DB_ASSERT(0);
+ DB_ASSERT(dbenv, 0);
}
dofree:
/* Free resources here. */