Commit 936755b7 authored by jimw@mysql.com's avatar jimw@mysql.com

Merge mysql.com:/home/jimw/my/mysql-5.1-bdb

into  mysql.com:/home/jimw/my/mysql-5.1-clean
parents 7a815c4f 6c18c133
......@@ -158,6 +158,26 @@ SOURCE=.\btree\btree_auto.c
# End Source File
# Begin Source File
SOURCE=.\crypto\aes_method.c
# End Source File
# Begin Source File
SOURCE=.\crypto\crypto.c
# End Source File
# Begin Source File
SOURCE=.\crypto\mersenne\mt19937db.c
# End Source File
# Begin Source File
SOURCE=.\crypto\rijndael\rijndael-alg-fst.c
# End Source File
# Begin Source File
SOURCE=.\crypto\rijndael\rijndael-api-fst.c
# End Source File
# Begin Source File
SOURCE=.\db\crdel_auto.c
# End Source File
# Begin Source File
......@@ -238,6 +258,10 @@ SOURCE=.\db\db_overflow.c
# End Source File
# Begin Source File
SOURCE=.\db\db_ovfl_vrfy.c
# End Source File
# Begin Source File
SOURCE=.\db\db_pr.c
# End Source File
# Begin Source File
......@@ -262,6 +286,18 @@ SOURCE=.\db\db_ret.c
# End Source File
# Begin Source File
SOURCE=.\db\db_setid.c
# End Source File
# Begin Source File
SOURCE=.\db\db_setlsn.c
# End Source File
# Begin Source File
SOURCE=.\db\db_stati.c
# End Source File
# Begin Source File
SOURCE=.\env\db_salloc.c
# End Source File
# Begin Source File
......@@ -306,6 +342,10 @@ SOURCE=.\dbreg\dbreg_rec.c
# End Source File
# Begin Source File
SOURCE=.\dbreg\dbreg_stat.c
# End Source File
# Begin Source File
SOURCE=.\dbreg\dbreg_util.c
# End Source File
# Begin Source File
......@@ -330,6 +370,10 @@ SOURCE=.\env\env_region.c
# End Source File
# Begin Source File
SOURCE=.\env\env_stat.c
# End Source File
# Begin Source File
SOURCE=.\fileops\fileops_auto.c
# End Source File
# Begin Source File
......@@ -418,6 +462,14 @@ SOURCE=.\lock\lock_deadlock.c
# End Source File
# Begin Source File
SOURCE=.\lock\lock_id.c
# End Source File
# Begin Source File
SOURCE=.\lock\lock_list.c
# End Source File
# Begin Source File
SOURCE=.\lock\lock_method.c
# End Source File
# Begin Source File
......@@ -430,6 +482,10 @@ SOURCE=.\lock\lock_stat.c
# End Source File
# Begin Source File
SOURCE=.\lock\lock_timer.c
# End Source File
# Begin Source File
SOURCE=.\lock\lock_util.c
# End Source File
# Begin Source File
......@@ -458,6 +514,10 @@ SOURCE=.\log\log_put.c
# End Source File
# Begin Source File
SOURCE=.\log\log_stat.c
# End Source File
# Begin Source File
SOURCE=.\mp\mp_alloc.c
# End Source File
# Begin Source File
......@@ -470,6 +530,10 @@ SOURCE=.\mp\mp_fget.c
# End Source File
# Begin Source File
SOURCE=.\mp\mp_fmethod.c
# End Source File
# Begin Source File
SOURCE=.\mp\mp_fopen.c
# End Source File
# Begin Source File
......@@ -614,6 +678,10 @@ SOURCE=.\os\os_tmpdir.c
# End Source File
# Begin Source File
SOURCE=.\os_win32\os_truncate.c
# End Source File
# Begin Source File
SOURCE=.\os_win32\os_type.c
# End Source File
# Begin Source File
......@@ -662,6 +730,14 @@ SOURCE=.\qam\qam_verify.c
# End Source File
# Begin Source File
SOURCE=.\rep\rep_auto.c
# End Source File
# Begin Source File
SOURCE=.\rep\rep_backup.c
# End Source File
# Begin Source File
SOURCE=.\rep\rep_method.c
# End Source File
# Begin Source File
......@@ -674,6 +750,10 @@ SOURCE=.\rep\rep_region.c
# End Source File
# Begin Source File
SOURCE=.\rep\rep_stat.c
# End Source File
# Begin Source File
SOURCE=.\rep\rep_util.c
# End Source File
# Begin Source File
......
......@@ -93,7 +93,8 @@ u_int32_t berkeley_lock_types[]=
TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names)-1,"",
berkeley_lock_names, NULL};
static void berkeley_print_error(const char *db_errpfx, char *buffer);
static void berkeley_print_error(const DB_ENV *db_env, const char *db_errpfx,
const char *buffer);
static byte* bdb_get_key(BDB_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)));
static BDB_SHARE *get_share(const char *table_name, TABLE *table);
......@@ -176,7 +177,7 @@ handlerton *berkeley_init(void)
if (opt_endinfo)
db_env->set_verbose(db_env,
DB_VERB_CHKPOINT | DB_VERB_DEADLOCK | DB_VERB_RECOVERY,
DB_VERB_DEADLOCK | DB_VERB_RECOVERY,
1);
db_env->set_cachesize(db_env, 0, berkeley_cache_size, 0);
......@@ -248,7 +249,7 @@ static int berkeley_commit(THD *thd, bool all)
DBUG_PRINT("trans",("ending transaction %s", all ? "all" : "stmt"));
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
DB_TXN **txn= all ? &trx->all : &trx->stmt;
int error=txn_commit(*txn,0);
int error= (*txn)->commit(*txn,0);
*txn=0;
#ifndef DBUG_OFF
if (error)
......@@ -263,7 +264,7 @@ static int berkeley_rollback(THD *thd, bool all)
DBUG_PRINT("trans",("aborting transaction %s", all ? "all" : "stmt"));
berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot];
DB_TXN **txn= all ? &trx->all : &trx->stmt;
int error=txn_abort(*txn);
int error= (*txn)->abort(*txn);
*txn=0;
DBUG_RETURN(error);
}
......@@ -321,7 +322,8 @@ int berkeley_show_logs(Protocol *protocol)
}
static void berkeley_print_error(const char *db_errpfx, char *buffer)
static void berkeley_print_error(const DB_ENV *db_env, const char *db_errpfx,
const char *buffer)
{
sql_print_error("%s: %s",db_errpfx,buffer); /* purecov: tested */
}
......@@ -612,7 +614,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
berkeley_cmp_packed_key));
if (!hidden_primary_key)
file->app_private= (void*) (table->key_info + table_share->primary_key);
if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) ||
if ((error= db_env->txn_begin(db_env, NULL, (DB_TXN**) &transaction, 0)) ||
(error= (file->open(file, transaction,
fn_format(name_buff, name, "", ha_berkeley_ext,
2 | 4),
......@@ -651,7 +653,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
DBUG_PRINT("bdb",("Setting DB_DUP for key %u", i));
(*ptr)->set_flags(*ptr, DB_DUP);
}
if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) ||
if ((error= db_env->txn_begin(db_env, NULL, (DB_TXN**) &transaction,
0)) ||
(error=((*ptr)->open(*ptr, transaction, name_buff, part, DB_BTREE,
open_mode, 0))) ||
(error= transaction->commit(transaction, 0)))
......@@ -1844,7 +1847,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
/* We have to start a master transaction */
DBUG_PRINT("trans",("starting transaction all: options: 0x%lx",
(ulong) thd->options));
if ((error=txn_begin(db_env, 0, &trx->all, 0)))
if ((error= db_env->txn_begin(db_env, NULL, &trx->all, 0)))
{
trx->bdb_lock_count--; // We didn't get the lock
DBUG_RETURN(error);
......@@ -1854,7 +1857,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
DBUG_RETURN(0); // Don't create stmt trans
}
DBUG_PRINT("trans",("starting transaction stmt"));
if ((error=txn_begin(db_env, trx->all, &trx->stmt, 0)))
if ((error= db_env->txn_begin(db_env, trx->all, &trx->stmt, 0)))
{
/* We leave the possible master transaction open */
trx->bdb_lock_count--; // We didn't get the lock
......@@ -1879,7 +1882,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type)
We must in this case commit the work to keep the row locks
*/
DBUG_PRINT("trans",("commiting non-updating transaction"));
error= txn_commit(trx->stmt,0);
error= trx->stmt->commit(trx->stmt,0);
trx->stmt= transaction= 0;
}
}
......@@ -1908,7 +1911,7 @@ int ha_berkeley::start_stmt(THD *thd)
if (!trx->stmt)
{
DBUG_PRINT("trans",("starting transaction stmt"));
error=txn_begin(db_env, trx->all, &trx->stmt, 0);
error= db_env->txn_begin(db_env, trx->all, &trx->stmt, 0);
trans_register_ha(thd, FALSE, &berkeley_hton);
}
transaction= trx->stmt;
......@@ -2289,7 +2292,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat);
stat=0;
}
if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0))
if ((key_file[i]->stat)(key_file[i], NULL, (void*) &stat, 0))
goto err; /* purecov: inspected */
share->rec_per_key[i]= (stat->bt_ndata /
(stat->bt_nkeys ? stat->bt_nkeys : 1));
......@@ -2302,7 +2305,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat);
stat=0;
}
if ((file->stat)(file, (void*) &stat, 0))
if ((file->stat)(file, NULL, (void*) &stat, 0))
goto err; /* purecov: inspected */
}
pthread_mutex_lock(&share->mutex);
......
/*-
* $Id: LICENSE,v 11.9 2002/01/11 15:51:10 bostic Exp $
* $Id: LICENSE,v 11.12 2004/03/30 20:49:44 bostic Exp $
*/
The following is the license that applies to this copy of the Berkeley DB
software. For a license to use the Berkeley DB software under conditions
other than those described here, or to purchase support for this software,
please contact Sleepycat Software by email at db@sleepycat.com, or on the
Web at http://www.sleepycat.com.
please contact Sleepycat Software by email at info@sleepycat.com, or on
the Web at http://www.sleepycat.com.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/*
* Copyright (c) 1990-2002
* Copyright (c) 1990-2004
* Sleepycat Software. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -38,14 +38,12 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_compare.c,v 11.20 2004/02/21 15:54:44 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_compare.c,v 11.17 2002/03/27 04:30:42 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#endif
......@@ -204,8 +202,12 @@ __bam_defpfx(dbp, a, b)
return (cnt);
/*
* We know that a->size must be <= b->size, or they wouldn't be
* in this order.
* They match up to the smaller of the two sizes.
* Collate the longer after the shorter.
*/
return (a->size < b->size ? a->size + 1 : a->size);
if (a->size < b->size)
return (a->size + 1);
if (b->size < a->size)
return (b->size + 1);
return (b->size);
}
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
* $Id: bt_conv.c,v 11.15 2004/01/28 03:35:48 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_conv.c,v 11.13 2002/08/06 06:11:12 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#endif
......
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
* $Id: bt_curadj.c,v 11.37 2004/03/13 14:11:33 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_curadj.c,v 11.30 2002/07/03 19:03:48 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#endif
......@@ -21,30 +19,6 @@ static const char revid[] = "$Id: bt_curadj.c,v 11.30 2002/07/03 19:03:48 bostic
static int __bam_opd_cursor __P((DB *, DBC *, db_pgno_t, u_int32_t, u_int32_t));
#ifdef DEBUG
/*
* __bam_cprint --
* Display the current internal cursor.
*
* PUBLIC: void __bam_cprint __P((DBC *));
*/
void
__bam_cprint(dbc)
DBC *dbc;
{
BTREE_CURSOR *cp;
cp = (BTREE_CURSOR *)dbc->internal;
fprintf(stderr, "\tinternal: ovflsize: %lu", (u_long)cp->ovflsize);
if (dbc->dbtype == DB_RECNO)
fprintf(stderr, " recno: %lu", (u_long)cp->recno);
if (F_ISSET(cp, C_DELETED))
fprintf(stderr, " (deleted)");
fprintf(stderr, "\n");
}
#endif
/*
* Cursor adjustments are logged if they are for subtransactions. This is
* because it's possible for a subtransaction to adjust cursors which will
......@@ -98,6 +72,19 @@ __bam_ca_delete(dbp, pgno, indx, delete)
dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) {
cp = (BTREE_CURSOR *)dbc->internal;
if (cp->pgno == pgno && cp->indx == indx) {
/*
* [#8032] This assert is checking
* for possible race conditions where we
* hold a cursor position without a lock.
* Unfortunately, there are paths in the
* Btree code that do not satisfy these
* conditions. None of them are known to
* be a problem, but this assert should
* be re-activated when the Btree stack
* code is re-written.
DB_ASSERT(!STD_LOCKING(dbc) ||
cp->lock_mode != DB_LOCK_NG);
*/
if (delete)
F_SET(cp, C_DELETED);
else
......@@ -192,7 +179,10 @@ __bam_ca_di(my_dbc, pgno, indx, adjust)
if (cp->pgno == pgno && cp->indx >= indx) {
/* Cursor indices should never be negative. */
DB_ASSERT(cp->indx != 0 || adjust > 0);
/* [#8032]
DB_ASSERT(!STD_LOCKING(dbc) ||
cp->lock_mode != DB_LOCK_NG);
*/
cp->indx += adjust;
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
......@@ -203,8 +193,8 @@ __bam_ca_di(my_dbc, pgno, indx, adjust)
MUTEX_THREAD_UNLOCK(dbenv, dbenv->dblist_mutexp);
if (found != 0 && DBC_LOGGING(my_dbc)) {
if ((ret = __bam_curadj_log(dbp, my_dbc->txn,
&lsn, 0, DB_CA_DI, pgno, 0, 0, adjust, indx, 0)) != 0)
if ((ret = __bam_curadj_log(dbp, my_dbc->txn, &lsn, 0,
DB_CA_DI, pgno, 0, 0, (u_int32_t)adjust, indx, 0)) != 0)
return (ret);
}
......@@ -319,6 +309,10 @@ loop: MUTEX_THREAD_LOCK(dbenv, dbp->mutexp);
continue;
MUTEX_THREAD_UNLOCK(dbenv, dbp->mutexp);
/* [#8032]
DB_ASSERT(!STD_LOCKING(dbc) ||
orig_cp->lock_mode != DB_LOCK_NG);
*/
if ((ret = __bam_opd_cursor(dbp,
dbc, first, tpgno, ti)) !=0)
return (ret);
......@@ -388,7 +382,7 @@ loop: MUTEX_THREAD_LOCK(dbenv, dbp->mutexp);
!= ti)
continue;
MUTEX_THREAD_UNLOCK(dbenv, dbp->mutexp);
if ((ret = orig_cp->opd->c_close(orig_cp->opd)) != 0)
if ((ret = __db_c_close(orig_cp->opd)) != 0)
return (ret);
orig_cp->opd = NULL;
orig_cp->indx = fi;
......@@ -442,6 +436,10 @@ __bam_ca_rsplit(my_dbc, fpgno, tpgno)
continue;
if (dbc->internal->pgno == fpgno) {
dbc->internal->pgno = tpgno;
/* [#8032]
DB_ASSERT(!STD_LOCKING(dbc) ||
dbc->internal->lock_mode != DB_LOCK_NG);
*/
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
}
......@@ -506,6 +504,10 @@ __bam_ca_split(my_dbc, ppgno, lpgno, rpgno, split_indx, cleft)
continue;
cp = dbc->internal;
if (cp->pgno == ppgno) {
/* [#8032]
DB_ASSERT(!STD_LOCKING(dbc) ||
cp->lock_mode != DB_LOCK_NG);
*/
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
if (cp->indx < split_indx) {
......
This diff is collapsed.
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -38,14 +38,12 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_delete.c,v 11.49 2004/02/27 12:38:28 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_delete.c,v 11.44 2002/07/03 19:03:49 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
......@@ -57,6 +55,7 @@ static const char revid[] = "$Id: bt_delete.c,v 11.44 2002/07/03 19:03:49 bostic
#include "dbinc/db_shash.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
/*
* __bam_ditem --
......@@ -161,7 +160,7 @@ __bam_ditem(dbc, h, indx)
/* Delete the item and mark the page dirty. */
if ((ret = __db_ditem(dbc, h, indx, nbytes)) != 0)
return (ret);
if ((ret = mpf->set(mpf, h, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fset(mpf, h, DB_MPOOL_DIRTY)) != 0)
return (ret);
return (0);
......@@ -211,7 +210,7 @@ __bam_adjindx(dbc, h, indx, indx_copy, is_insert)
memmove(&inp[indx], &inp[indx + O_INDX],
sizeof(db_indx_t) * (NUM_ENT(h) - indx));
}
if ((ret = mpf->set(mpf, h, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fset(mpf, h, DB_MPOOL_DIRTY)) != 0)
return (ret);
return (0);
......@@ -260,9 +259,10 @@ __bam_dpages(dbc, stack_epg)
*/
ret = 0;
for (epg = cp->sp; epg < stack_epg; ++epg) {
if ((t_ret = mpf->put(mpf, epg->page, 0)) != 0 && ret == 0)
if ((t_ret = __memp_fput(mpf, epg->page, 0)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
(void)__TLPUT(dbc, epg->lock);
}
if (ret != 0)
goto err;
......@@ -276,7 +276,7 @@ __bam_dpages(dbc, stack_epg)
* It will deadlock here. Before we unlink the subtree, we relink the
* leaf page chain.
*/
if ((ret = __db_relink(dbc, DB_REM_PAGE, cp->csp->page, NULL, 1)) != 0)
if ((ret = __bam_relink(dbc, cp->csp->page, NULL)) != 0)
goto err;
/*
......@@ -295,9 +295,11 @@ __bam_dpages(dbc, stack_epg)
pgno = PGNO(epg->page);
nitems = NUM_ENT(epg->page);
if ((ret = mpf->put(mpf, epg->page, 0)) != 0)
ret = __memp_fput(mpf, epg->page, 0);
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err_inc;
(void)__TLPUT(dbc, epg->lock);
/* Free the rest of the pages in the stack. */
while (++epg <= cp->csp) {
......@@ -314,18 +316,19 @@ __bam_dpages(dbc, stack_epg)
goto err;
}
if ((ret = __db_free(dbc, epg->page)) != 0) {
epg->page = NULL;
ret = __db_free(dbc, epg->page);
epg->page = NULL;
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err_inc;
}
(void)__TLPUT(dbc, epg->lock);
}
if (0) {
err_inc: ++epg;
err: for (; epg <= cp->csp; ++epg) {
if (epg->page != NULL)
(void)mpf->put(mpf, epg->page, 0);
(void)__memp_fput(mpf, epg->page, 0);
(void)__TLPUT(dbc, epg->lock);
}
BT_STK_CLR(cp);
......@@ -354,7 +357,7 @@ err: for (; epg <= cp->csp; ++epg) {
if ((ret =
__db_lget(dbc, 0, pgno, DB_LOCK_WRITE, 0, &p_lock)) != 0)
goto stop;
if ((ret = mpf->get(mpf, &pgno, 0, &parent)) != 0)
if ((ret = __memp_fget(mpf, &pgno, 0, &parent)) != 0)
goto stop;
if (NUM_ENT(parent) != 1)
......@@ -384,7 +387,7 @@ err: for (; epg <= cp->csp; ++epg) {
if ((ret =
__db_lget(dbc, 0, pgno, DB_LOCK_WRITE, 0, &c_lock)) != 0)
goto stop;
if ((ret = mpf->get(mpf, &pgno, 0, &child)) != 0)
if ((ret = __memp_fget(mpf, &pgno, 0, &child)) != 0)
goto stop;
/* Log the change. */
......@@ -423,9 +426,9 @@ err: for (; epg <= cp->csp; ++epg) {
RE_NREC_SET(parent, rcnt);
/* Mark the pages dirty. */
if ((ret = mpf->set(mpf, parent, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fset(mpf, parent, DB_MPOOL_DIRTY)) != 0)
goto stop;
if ((ret = mpf->set(mpf, child, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fset(mpf, child, DB_MPOOL_DIRTY)) != 0)
goto stop;
/* Adjust the cursors. */
......@@ -446,15 +449,125 @@ err: for (; epg <= cp->csp; ++epg) {
if (0) {
stop: done = 1;
}
(void)__TLPUT(dbc, p_lock);
if ((t_ret = __TLPUT(dbc, p_lock)) != 0 && ret == 0)
ret = t_ret;
if (parent != NULL &&
(t_ret = mpf->put(mpf, parent, 0)) != 0 && ret == 0)
(t_ret = __memp_fput(mpf, parent, 0)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, c_lock)) != 0 && ret == 0)
ret = t_ret;
(void)__TLPUT(dbc, c_lock);
if (child != NULL &&
(t_ret = mpf->put(mpf, child, 0)) != 0 && ret == 0)
(t_ret = __memp_fput(mpf, child, 0)) != 0 && ret == 0)
ret = t_ret;
}
return (ret);
}
/*
* __bam_relink --
* Relink around a deleted page.
*
* PUBLIC: int __bam_relink __P((DBC *, PAGE *, PAGE **));
*/
int
__bam_relink(dbc, pagep, new_next)
DBC *dbc;
PAGE *pagep, **new_next;
{
DB *dbp;
PAGE *np, *pp;
DB_LOCK npl, ppl;
DB_LSN *nlsnp, *plsnp, ret_lsn;
DB_MPOOLFILE *mpf;
int ret, t_ret;
dbp = dbc->dbp;
np = pp = NULL;
LOCK_INIT(npl);
LOCK_INIT(ppl);
nlsnp = plsnp = NULL;
mpf = dbp->mpf;
ret = 0;
/*
* Retrieve and lock the one/two pages. For a remove, we may need
* two pages (the before and after). For an add, we only need one
* because, the split took care of the prev.
*/
if (pagep->next_pgno != PGNO_INVALID) {
if ((ret = __db_lget(dbc,
0, pagep->next_pgno, DB_LOCK_WRITE, 0, &npl)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &pagep->next_pgno, 0, &np)) != 0) {
ret = __db_pgerr(dbp, pagep->next_pgno, ret);
goto err;
}
nlsnp = &np->lsn;
}
if (pagep->prev_pgno != PGNO_INVALID) {
if ((ret = __db_lget(dbc,
0, pagep->prev_pgno, DB_LOCK_WRITE, 0, &ppl)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &pagep->prev_pgno, 0, &pp)) != 0) {
ret = __db_pgerr(dbp, pagep->prev_pgno, ret);
goto err;
}
plsnp = &pp->lsn;
}
/* Log the change. */
if (DBC_LOGGING(dbc)) {
if ((ret = __bam_relink_log(dbp, dbc->txn, &ret_lsn, 0,
pagep->pgno, &pagep->lsn, pagep->prev_pgno, plsnp,
pagep->next_pgno, nlsnp)) != 0)
goto err;
} else
LSN_NOT_LOGGED(ret_lsn);
if (np != NULL)
np->lsn = ret_lsn;
if (pp != NULL)
pp->lsn = ret_lsn;
pagep->lsn = ret_lsn;
/*
* Modify and release the two pages.
*
* !!!
* The parameter new_next gets set to the page following the page we
* are removing. If there is no following page, then new_next gets
* set to NULL.
*/
if (np != NULL) {
np->prev_pgno = pagep->prev_pgno;
if (new_next == NULL)
ret = __memp_fput(mpf, np, DB_MPOOL_DIRTY);
else {
*new_next = np;
ret = __memp_fset(mpf, np, DB_MPOOL_DIRTY);
}
if ((t_ret = __TLPUT(dbc, npl)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err;
} else if (new_next != NULL)
*new_next = NULL;
if (pp != NULL) {
pp->next_pgno = pagep->next_pgno;
ret = __memp_fput(mpf, pp, DB_MPOOL_DIRTY);
if ((t_ret = __TLPUT(dbc, ppl)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err;
}
return (0);
err: if (np != NULL)
(void)__memp_fput(mpf, np, 0);
(void)__TLPUT(dbc, npl);
if (pp != NULL)
(void)__memp_fput(mpf, pp, 0);
(void)__TLPUT(dbc, ppl);
return (ret);
}
This diff is collapsed.
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -38,18 +38,15 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_open.c,v 11.92 2004/04/29 14:39:47 ubell Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_open.c,v 11.76 2002/09/04 19:06:42 margo Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <limits.h>
#include <string.h>
#endif
......@@ -61,6 +58,7 @@ static const char revid[] = "$Id: bt_open.c,v 11.76 2002/09/04 19:06:42 margo Ex
#include "dbinc/db_shash.h"
#include "dbinc/lock.h"
#include "dbinc/log.h"
#include "dbinc/mp.h"
#include "dbinc/fop.h"
static void __bam_init_meta __P((DB *, BTMETA *, db_pgno_t, DB_LSN *));
......@@ -85,10 +83,6 @@ __bam_open(dbp, txn, name, base_pgno, flags)
COMPQUIET(name, NULL);
t = dbp->bt_internal;
/* Initialize the remaining fields/methods of the DB. */
dbp->key_range = __bam_key_range;
dbp->stat = __bam_stat;
/*
* We don't permit the user to specify a prefix routine if they didn't
* also specify a comparison routine, they can't know enough about our
......@@ -290,6 +284,7 @@ __bam_read_root(dbp, txn, base_pgno, flags)
DB_MPOOLFILE *mpf;
int ret, t_ret;
COMPQUIET(flags, 0);
meta = NULL;
t = dbp->bt_internal;
LOCK_INIT(metalock);
......@@ -297,14 +292,14 @@ __bam_read_root(dbp, txn, base_pgno, flags)
ret = 0;
/* Get a cursor. */
if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
if ((ret = __db_cursor(dbp, txn, &dbc, 0)) != 0)
return (ret);
/* Get the metadata page. */
if ((ret =
__db_lget(dbc, 0, base_pgno, DB_LOCK_READ, 0, &metalock)) != 0)
goto err;
if ((ret = mpf->get(mpf, &base_pgno, 0, (PAGE **)&meta)) != 0)
if ((ret = __memp_fget(mpf, &base_pgno, 0, &meta)) != 0)
goto err;
/*
......@@ -315,16 +310,18 @@ __bam_read_root(dbp, txn, base_pgno, flags)
* Otherwise, we'd better be in recovery or abort, in which case the
* metadata page will be created/initialized elsewhere.
*/
DB_ASSERT(meta->dbmeta.magic != 0 ||
IS_RECOVERING(dbp->dbenv) || F_ISSET(dbp, DB_AM_RECOVER));
t->bt_maxkey = meta->maxkey;
t->bt_minkey = meta->minkey;
t->re_pad = meta->re_pad;
t->re_len = meta->re_len;
t->bt_meta = base_pgno;
t->bt_root = meta->root;
if (meta->dbmeta.magic == DB_BTREEMAGIC) {
t->bt_maxkey = meta->maxkey;
t->bt_minkey = meta->minkey;
t->re_pad = (int)meta->re_pad;
t->re_len = meta->re_len;
t->bt_meta = base_pgno;
t->bt_root = meta->root;
} else {
DB_ASSERT(IS_RECOVERING(dbp->dbenv) ||
F_ISSET(dbp, DB_AM_RECOVER));
}
/*
* !!!
......@@ -337,21 +334,14 @@ __bam_read_root(dbp, txn, base_pgno, flags)
*/
t->bt_lpgno = PGNO_INVALID;
/* We must initialize last_pgno, it could be stale. */
if (!LF_ISSET(DB_RDONLY) && dbp->meta_pgno == PGNO_BASE_MD) {
mpf->last_pgno(mpf, &meta->dbmeta.last_pgno);
ret = mpf->put(mpf, meta, DB_MPOOL_DIRTY);
} else
ret = mpf->put(mpf, meta, 0);
meta = NULL;
err: /* Put the metadata page back. */
if (meta != NULL && (t_ret = mpf->put(mpf, meta, 0)) != 0 && ret == 0)
if (meta != NULL &&
(t_ret = __memp_fput(mpf, meta, 0)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
......@@ -408,7 +398,7 @@ __bam_init_meta(dbp, meta, pgno, lsnp)
meta->maxkey = t->bt_maxkey;
meta->minkey = t->bt_minkey;
meta->re_len = t->re_len;
meta->re_pad = t->re_pad;
meta->re_pad = (u_int32_t)t->re_pad;
}
/*
......@@ -418,8 +408,8 @@ __bam_init_meta(dbp, meta, pgno, lsnp)
* This code appears more complex than it is because of the two cases (named
* and unnamed). The way to read the code is that for each page being created,
* there are three parts: 1) a "get page" chunk (which either uses malloc'd
* memory or calls mpf->get), 2) the initialization, and 3) the "put page"
* chunk which either does a fop write or an mpf->put.
* memory or calls __memp_fget), 2) the initialization, and 3) the "put page"
* chunk which either does a fop write or an __memp_fput.
*
* PUBLIC: int __bam_new_file __P((DB *, DB_TXN *, DB_FH *, const char *));
*/
......@@ -445,78 +435,84 @@ __bam_new_file(dbp, txn, fhp, name)
mpf = dbp->mpf;
root = NULL;
meta = NULL;
memset(&pdbt, 0, sizeof(pdbt));
/* Build meta-data page. */
buf = NULL;
if (name == NULL) {
/* Build the meta-data page. */
pgno = PGNO_BASE_MD;
ret = mpf->get(mpf, &pgno, DB_MPOOL_CREATE, &meta);
if ((ret =
__memp_fget(mpf, &pgno, DB_MPOOL_CREATE, &meta)) != 0)
return (ret);
LSN_NOT_LOGGED(lsn);
__bam_init_meta(dbp, meta, PGNO_BASE_MD, &lsn);
meta->root = 1;
meta->dbmeta.last_pgno = 1;
ret = __memp_fput(mpf, meta, DB_MPOOL_DIRTY);
meta = NULL;
if (ret != 0)
goto err;
/* Build the root page. */
pgno = 1;
if ((ret =
__memp_fget(mpf, &pgno, DB_MPOOL_CREATE, &root)) != 0)
goto err;
P_INIT(root, dbp->pgsize, 1, PGNO_INVALID, PGNO_INVALID,
LEAFLEVEL, dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE);
LSN_NOT_LOGGED(root->lsn);
ret = __memp_fput(mpf, root, DB_MPOOL_DIRTY);
root = NULL;
if (ret != 0)
goto err;
} else {
memset(&pdbt, 0, sizeof(pdbt));
/* Build the meta-data page. */
pginfo.db_pagesize = dbp->pgsize;
pginfo.flags =
F_ISSET(dbp, (DB_AM_CHKSUM | DB_AM_ENCRYPT | DB_AM_SWAP));
pginfo.type = dbp->type;
pdbt.data = &pginfo;
pdbt.size = sizeof(pginfo);
ret = __os_calloc(dbp->dbenv, 1, dbp->pgsize, &buf);
if ((ret = __os_calloc(dbenv, 1, dbp->pgsize, &buf)) != 0)
return (ret);
meta = (BTMETA *)buf;
}
if (ret != 0)
return (ret);
LSN_NOT_LOGGED(lsn);
__bam_init_meta(dbp, meta, PGNO_BASE_MD, &lsn);
meta->root = 1;
meta->dbmeta.last_pgno = 1;
if (name == NULL)
ret = mpf->put(mpf, meta, DB_MPOOL_DIRTY);
else {
LSN_NOT_LOGGED(lsn);
__bam_init_meta(dbp, meta, PGNO_BASE_MD, &lsn);
meta->root = 1;
meta->dbmeta.last_pgno = 1;
if ((ret = __db_pgout(dbenv, PGNO_BASE_MD, meta, &pdbt)) != 0)
goto err;
ret = __fop_write(dbenv,
txn, name, DB_APP_DATA, fhp, 0, buf, dbp->pgsize, 1);
}
if (ret != 0)
goto err;
meta = NULL;
/* Now build root page. */
if (name == NULL) {
pgno = 1;
if ((ret = mpf->get(mpf, &pgno, DB_MPOOL_CREATE, &root)) != 0)
if ((ret = __fop_write(dbenv, txn, name, DB_APP_DATA, fhp,
dbp->pgsize, 0, 0, buf, dbp->pgsize, 1, F_ISSET(
dbp, DB_AM_NOT_DURABLE) ? DB_LOG_NOT_DURABLE : 0)) != 0)
goto err;
} else {
meta = NULL;
/* Build the root page. */
#ifdef DIAGNOSTIC
memset(buf, 0, dbp->pgsize);
memset(buf, CLEAR_BYTE, dbp->pgsize);
#endif
root = (PAGE *)buf;
}
P_INIT(root, dbp->pgsize, 1, PGNO_INVALID, PGNO_INVALID,
LEAFLEVEL, dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE);
LSN_NOT_LOGGED(root->lsn);
if (name == NULL)
ret = mpf->put(mpf, root, DB_MPOOL_DIRTY);
else {
P_INIT(root, dbp->pgsize, 1, PGNO_INVALID, PGNO_INVALID,
LEAFLEVEL, dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE);
LSN_NOT_LOGGED(root->lsn);
if ((ret = __db_pgout(dbenv, root->pgno, root, &pdbt)) != 0)
goto err;
ret = __fop_write(dbenv, txn,
name, DB_APP_DATA, fhp, dbp->pgsize, buf, dbp->pgsize, 1);
if ((ret = __fop_write(dbenv, txn, name, DB_APP_DATA, fhp,
dbp->pgsize, 1, 0, buf, dbp->pgsize, 1, F_ISSET(
dbp, DB_AM_NOT_DURABLE) ? DB_LOG_NOT_DURABLE : 0)) != 0)
goto err;
root = NULL;
}
if (ret != 0)
goto err;
root = NULL;
err: if (name != NULL)
err: if (buf != NULL)
__os_free(dbenv, buf);
else {
if (meta != NULL)
(void)mpf->put(mpf, meta, 0);
(void)__memp_fput(mpf, meta, 0);
if (root != NULL)
(void)mpf->put(mpf, root, 0);
(void)__memp_fput(mpf, root, 0);
}
return (ret);
}
......@@ -547,7 +543,7 @@ __bam_new_subdb(mdbp, dbp, txn)
meta = NULL;
root = NULL;
if ((ret = mdbp->cursor(mdbp, txn,
if ((ret = __db_cursor(mdbp, txn,
&dbc, CDB_LOCKING(dbenv) ? DB_WRITECURSOR : 0)) != 0)
return (ret);
......@@ -555,7 +551,8 @@ __bam_new_subdb(mdbp, dbp, txn)
if ((ret = __db_lget(dbc,
0, dbp->meta_pgno, DB_LOCK_WRITE, 0, &metalock)) != 0)
goto err;
if ((ret = mpf->get(mpf, &dbp->meta_pgno, DB_MPOOL_CREATE, &meta)) != 0)
if ((ret =
__memp_fget(mpf, &dbp->meta_pgno, DB_MPOOL_CREATE, &meta)) != 0)
goto err;
/* Build meta-data page. */
......@@ -582,24 +579,23 @@ __bam_new_subdb(mdbp, dbp, txn)
goto err;
/* Release the metadata and root pages. */
if ((ret = mpf->put(mpf, meta, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fput(mpf, meta, DB_MPOOL_DIRTY)) != 0)
goto err;
meta = NULL;
if ((ret = mpf->put(mpf, root, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fput(mpf, root, DB_MPOOL_DIRTY)) != 0)
goto err;
root = NULL;
err:
if (meta != NULL)
if ((t_ret = mpf->put(mpf, meta, 0)) != 0 && ret == 0)
if ((t_ret = __memp_fput(mpf, meta, 0)) != 0 && ret == 0)
ret = t_ret;
if (root != NULL)
if ((t_ret = mpf->put(mpf, root, 0)) != 0 && ret == 0)
ret = t_ret;
if (LOCK_ISSET(metalock))
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
if ((t_ret = __memp_fput(mpf, root, 0)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
ret = t_ret;
if (dbc != NULL)
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -38,14 +38,12 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_put.c,v 11.80 2004/10/29 17:33:25 ubell Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_put.c,v 11.69 2002/08/06 06:11:12 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
......@@ -54,7 +52,9 @@ static const char revid[] = "$Id: bt_put.c,v 11.69 2002/08/06 06:11:12 bostic Ex
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/db_shash.h"
#include "dbinc/btree.h"
#include "dbinc/mp.h"
static int __bam_build
__P((DBC *, u_int32_t, DBT *, PAGE *, u_int32_t, u_int32_t));
......@@ -76,6 +76,7 @@ __bam_iitem(dbc, key, data, op, flags)
DBT *key, *data;
u_int32_t op, flags;
{
DB_ENV *dbenv;
BKEYDATA *bk, bk_tmp;
BTREE *t;
BTREE_CURSOR *cp;
......@@ -90,6 +91,7 @@ __bam_iitem(dbc, key, data, op, flags)
COMPQUIET(bk, NULL);
dbp = dbc->dbp;
dbenv = dbp->dbenv;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
t = dbp->bt_internal;
......@@ -102,10 +104,8 @@ __bam_iitem(dbc, key, data, op, flags)
* anything other simple overwrite.
*/
if (F_ISSET(dbp, DB_AM_FIXEDLEN) &&
F_ISSET(data, DB_DBT_PARTIAL) && data->dlen != data->size) {
data_size = data->size;
goto len_err;
}
F_ISSET(data, DB_DBT_PARTIAL) && data->size != data->dlen)
return (__db_rec_repl(dbenv, data->size, data->dlen));
/*
* Figure out how much space the data will take, including if it's a
......@@ -119,12 +119,8 @@ __bam_iitem(dbc, key, data, op, flags)
__bam_partsize(dbp, op, data, h, indx) : data->size;
padrec = 0;
if (F_ISSET(dbp, DB_AM_FIXEDLEN)) {
if (data_size > t->re_len) {
len_err: __db_err(dbp->dbenv,
"Length improper for fixed length record %lu",
(u_long)data_size);
return (EINVAL);
}
if (data_size > t->re_len)
return (__db_rec_toobig(dbenv, data_size, t->re_len));
/* Records that are deleted anyway needn't be padded out. */
if (!LF_ISSET(BI_DELETED) && data_size < t->re_len) {
......@@ -158,8 +154,8 @@ len_err: __db_err(dbp->dbenv,
dbp->dup_compare, &cmp)) != 0)
return (ret);
if (cmp != 0) {
__db_err(dbp->dbenv,
"Current data differs from put data");
__db_err(dbenv,
"Existing data sorts differently from put data");
return (EINVAL);
}
}
......@@ -218,19 +214,14 @@ len_err: __db_err(dbp->dbenv,
needed += need_bytes - have_bytes;
break;
default:
return (__db_unknown_flag(dbp->dbenv, "__bam_iitem", op));
return (__db_unknown_flag(dbenv, "DB->put", op));
}
/*
* If there's not enough room, or the user has put a ceiling on the
* number of keys permitted in the page, split the page.
*
* XXX
* The t->bt_maxkey test here may be insufficient -- do we have to
* check in the btree split code, so we don't undo it there!?!?
*/
if (P_FREESPACE(dbp, h) < needed ||
(t->bt_maxkey != 0 && NUM_ENT(h) > t->bt_maxkey))
if (P_FREESPACE(dbp, h) < needed)
return (DB_NEEDSPLIT);
/*
......@@ -294,23 +285,24 @@ len_err: __db_err(dbp->dbenv,
* we deadlock or fail while deleting the overflow item or
* replacing the non-overflow item, a subsequent cursor close
* will try and remove the item because the cursor's delete
* flag is set
* flag is set.
*/
(void)__bam_ca_delete(dbp, PGNO(h), indx, 0);
if (TYPE(h) == P_LBTREE) {
++indx;
dupadjust = 1;
}
/*
* In a Btree deleted records aren't counted (deleted
* records are counted in a Recno because all accesses
* are based on record number). If it's a Btree and
* it's a DB_CURRENT operation overwriting a previously
* deleted record, increment the record count.
*/
/*
* In a Btree deleted records aren't counted (deleted records
* are counted in a Recno because all accesses are based on
* record number). If it's a Btree and it's a DB_CURRENT
* operation overwriting a previously deleted record, increment
* the record count.
*/
if (TYPE(h) == P_LBTREE || TYPE(h) == P_LDUP)
was_deleted = B_DISSET(bk->type);
}
/*
* 4. Delete and re-add the data item.
......@@ -331,7 +323,7 @@ len_err: __db_err(dbp->dbenv,
replace = 1;
break;
default:
return (__db_unknown_flag(dbp->dbenv, "__bam_iitem", op));
return (__db_unknown_flag(dbenv, "DB->put", op));
}
/* Add the data. */
......@@ -360,7 +352,7 @@ len_err: __db_err(dbp->dbenv,
if (ret != 0)
return (ret);
}
if ((ret = mpf->set(mpf, h, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fset(mpf, h, DB_MPOOL_DIRTY)) != 0)
return (ret);
/*
......@@ -648,7 +640,7 @@ __bam_ritem(dbc, h, indx, data)
if (p == t) /* First index is fast. */
inp[indx] += nbytes;
else { /* Else, shift the page. */
memmove(p + nbytes, p, t - p);
memmove(p + nbytes, p, (size_t)(t - p));
/* Adjust the indices' offsets. */
off = inp[indx];
......@@ -700,12 +692,16 @@ __bam_dup_convert(dbc, h, indx)
*/
while (indx > 0 && inp[indx] == inp[indx - P_INDX])
indx -= P_INDX;
for (cnt = 0, sz = 0, first = indx;; ++cnt, indx += P_INDX) {
if (indx >= NUM_ENT(h) || inp[first] != inp[indx])
break;
bk = GET_BKEYDATA(dbp, h, indx);
sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
/* Count the key once. */
bk = GET_BKEYDATA(dbp, h, indx);
sz = B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
/* Sum up all the data items. */
for (cnt = 0, first = indx;
indx < NUM_ENT(h) && inp[first] == inp[indx];
++cnt, indx += P_INDX) {
bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
......@@ -800,14 +796,14 @@ __bam_dup_convert(dbc, h, indx)
B_DUPLICATE, dp->pgno, h, first + 1, NULL)) != 0)
goto err;
/* Adjust cursors for all the above movments. */
/* Adjust cursors for all the above movements. */
if ((ret = __bam_ca_di(dbc,
PGNO(h), first + P_INDX, first + P_INDX - indx)) != 0)
PGNO(h), first + P_INDX, (int)(first + P_INDX - indx))) != 0)
goto err;
return (mpf->put(mpf, dp, DB_MPOOL_DIRTY));
return (__memp_fput(mpf, dp, DB_MPOOL_DIRTY));
err: (void)mpf->put(mpf, dp, 0);
err: (void)__memp_fput(mpf, dp, 0);
return (ret);
}
......
This diff is collapsed.
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1998-2002
* Copyright (c) 1998-2004
* Sleepycat Software. All rights reserved.
*
* $Id: bt_reclaim.c,v 11.15 2004/01/28 03:35:49 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_reclaim.c,v 11.11 2002/03/29 20:46:26 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
......@@ -36,7 +34,7 @@ __bam_reclaim(dbp, txn)
int ret, t_ret;
/* Acquire a cursor. */
if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
if ((ret = __db_cursor(dbp, txn, &dbc, 0)) != 0)
return (ret);
/* Walk the tree, freeing pages. */
......@@ -44,7 +42,7 @@ __bam_reclaim(dbp, txn)
DB_LOCK_WRITE, dbc->internal->root, __db_reclaim_callback, dbc);
/* Discard the cursor. */
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0)
ret = t_ret;
return (ret);
......@@ -54,32 +52,23 @@ __bam_reclaim(dbp, txn)
* __bam_truncate --
* Truncate a database.
*
* PUBLIC: int __bam_truncate __P((DB *, DB_TXN *, u_int32_t *));
* PUBLIC: int __bam_truncate __P((DBC *, u_int32_t *));
*/
int
__bam_truncate(dbp, txn, countp)
DB *dbp;
DB_TXN *txn;
__bam_truncate(dbc, countp)
DBC *dbc;
u_int32_t *countp;
{
DBC *dbc;
db_trunc_param trunc;
int ret, t_ret;
/* Acquire a cursor. */
if ((ret = dbp->cursor(dbp, txn, &dbc, 0)) != 0)
return (ret);
int ret;
trunc.count = 0;
trunc.dbc = dbc;
/* Walk the tree, freeing pages. */
ret = __bam_traverse(dbc,
DB_LOCK_WRITE, dbc->internal->root, __db_truncate_callback, &trunc);
/* Discard the cursor. */
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
ret = t_ret;
*countp = trunc.count;
return (ret);
......
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997-2002
* Copyright (c) 1997-2004
* Sleepycat Software. All rights reserved.
*
* $Id: bt_recno.c,v 11.117 2004/03/28 17:01:01 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_recno.c,v 11.106 2002/08/16 04:56:30 ubell Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#endif
......@@ -58,7 +54,7 @@ static int __ram_update __P((DBC *, db_recno_t, int));
} \
}
#define CD_ISSET(cp) \
(F_ISSET(cp, C_RENUMBER) && F_ISSET(cp, C_DELETED))
(F_ISSET(cp, C_RENUMBER) && F_ISSET(cp, C_DELETED) ? 1 : 0)
/*
* Macros for comparing the ordering of two cursors.
......@@ -91,11 +87,13 @@ static int __ram_update __P((DBC *, db_recno_t, int));
* After a search, copy the found page into the cursor, discarding any
* currently held lock.
*/
#define STACK_TO_CURSOR(cp) { \
#define STACK_TO_CURSOR(cp, ret) { \
int __t_ret; \
(cp)->page = (cp)->csp->page; \
(cp)->pgno = (cp)->csp->page->pgno; \
(cp)->indx = (cp)->csp->indx; \
(void)__TLPUT(dbc, (cp)->lock); \
if ((__t_ret = __TLPUT(dbc, (cp)->lock)) != 0 && (ret) == 0) \
ret = __t_ret; \
(cp)->lock = (cp)->csp->lock; \
(cp)->lock_mode = (cp)->csp->lock_mode; \
}
......@@ -122,9 +120,6 @@ __ram_open(dbp, txn, name, base_pgno, flags)
COMPQUIET(name, NULL);
t = dbp->bt_internal;
/* Initialize the remaining fields/methods of the DB. */
dbp->stat = __bam_stat;
/* Start up the tree. */
if ((ret = __bam_read_root(dbp, txn, base_pgno, flags)) != 0)
return (ret);
......@@ -143,7 +138,7 @@ __ram_open(dbp, txn, name, base_pgno, flags)
/* If we're snapshotting an underlying source file, do it now. */
if (F_ISSET(dbp, DB_AM_SNAPSHOT)) {
/* Allocate a cursor. */
if ((ret = dbp->cursor(dbp, NULL, &dbc, 0)) != 0)
if ((ret = __db_cursor(dbp, NULL, &dbc, 0)) != 0)
return (ret);
/* Do the snapshot. */
......@@ -152,7 +147,7 @@ __ram_open(dbp, txn, name, base_pgno, flags)
ret = 0;
/* Discard the cursor. */
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0)
ret = t_ret;
}
......@@ -209,7 +204,7 @@ __ram_c_del(dbc)
DB_LSN lsn;
DBT hdr, data;
EPG *epg;
int exact, ret, stack;
int exact, ret, stack, t_ret;
dbp = dbc->dbp;
cp = (BTREE_CURSOR *)dbc->internal;
......@@ -240,7 +235,9 @@ __ram_c_del(dbc)
stack = 1;
/* Copy the page into the cursor. */
STACK_TO_CURSOR(cp);
STACK_TO_CURSOR(cp, ret);
if (ret != 0)
goto err;
/*
* If re-numbering records, the on-page deleted flag can only mean
......@@ -262,7 +259,8 @@ __ram_c_del(dbc)
/* Delete the item, adjust the counts, adjust the cursors. */
if ((ret = __bam_ditem(dbc, cp->page, cp->indx)) != 0)
goto err;
__bam_adjust(dbc, -1);
if ((ret = __bam_adjust(dbc, -1)) != 0)
goto err;
if (__ram_ca(dbc, CA_DELETE) > 0 &&
CURADJ_LOG(dbc) && (ret = __bam_rcuradj_log(dbp, dbc->txn,
&lsn, 0, CA_DELETE, cp->root, cp->recno, cp->order)) != 0)
......@@ -325,8 +323,8 @@ __ram_c_del(dbc)
t->re_modified = 1;
err: if (stack)
__bam_stkrel(dbc, STK_CLRDBC);
err: if (stack && (t_ret = __bam_stkrel(dbc, STK_CLRDBC)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
......@@ -388,8 +386,13 @@ retry: switch (flags) {
* we have to avoid incrementing the record number so that we
* return the right record by virtue of renumbering the tree.
*/
if (CD_ISSET(cp))
if (CD_ISSET(cp)) {
/*
* Clear the flag, we've moved off the deleted record.
*/
CD_CLR(cp);
break;
}
if (cp->recno != RECNO_OOB) {
++cp->recno;
......@@ -494,7 +497,9 @@ retry: switch (flags) {
}
/* Copy the page into the cursor. */
STACK_TO_CURSOR(cp);
STACK_TO_CURSOR(cp, ret);
if (ret != 0)
goto err;
/*
* If re-numbering records, the on-page deleted flag means this
......@@ -607,9 +612,11 @@ __ram_c_put(dbc, key, data, flags, pgnop)
return (ret);
if (CURADJ_LOG(dbc) &&
(ret = __bam_rcuradj_log(dbp, dbc->txn, &lsn, 0,
CA_ICURRENT, cp->root, cp->recno, cp->order)))
CA_ICURRENT, cp->root, cp->recno, cp->order)) != 0)
return (ret);
return (0);
default:
break;
}
/*
......@@ -650,7 +657,9 @@ split: if ((ret = __bam_rsearch(dbc, &cp->recno, S_INSERT, 1, &exact)) != 0)
DB_ASSERT(exact || CD_ISSET(cp));
/* Copy the page into the cursor. */
STACK_TO_CURSOR(cp);
STACK_TO_CURSOR(cp, ret);
if (ret != 0)
goto err;
ret = __bam_iitem(dbc, key, data, iiflags, 0);
t_ret = __bam_stkrel(dbc, STK_CLRDBC);
......@@ -708,6 +717,8 @@ split: if ((ret = __bam_rsearch(dbc, &cp->recno, S_INSERT, 1, &exact)) != 0)
CA_ICURRENT, cp->root, cp->recno, cp->order)) != 0)
goto err;
break;
default:
break;
}
/* Return the key if we've created a new record. */
......@@ -983,7 +994,7 @@ __ram_source(dbp)
* when it comes time to write the database back to the source.
*/
if ((t->re_fp = fopen(t->re_source, "r")) == NULL) {
ret = errno;
ret = __os_get_errno();
__db_err(dbp->dbenv, "%s: %s", t->re_source, db_strerror(ret));
return (ret);
}
......@@ -1027,7 +1038,7 @@ __ram_writeback(dbp)
}
/* Allocate a cursor. */
if ((ret = dbp->cursor(dbp, NULL, &dbc, 0)) != 0)
if ((ret = __db_cursor(dbp, NULL, &dbc, 0)) != 0)
return (ret);
/*
......@@ -1060,13 +1071,13 @@ __ram_writeback(dbp)
*/
if (t->re_fp != NULL) {
if (fclose(t->re_fp) != 0) {
ret = errno;
ret = __os_get_errno();
goto err;
}
t->re_fp = NULL;
}
if ((fp = fopen(t->re_source, "w")) == NULL) {
ret = errno;
ret = __os_get_errno();
__db_err(dbenv, "%s: %s", t->re_source, db_strerror(ret));
goto err;
}
......@@ -1088,23 +1099,24 @@ __ram_writeback(dbp)
* and the pad character if we're doing fixed-length records.
*/
delim = t->re_delim;
if (F_ISSET(dbp, DB_AM_FIXEDLEN)) {
if ((ret = __os_malloc(dbenv, t->re_len, &pad)) != 0)
goto err;
memset(pad, t->re_pad, t->re_len);
}
for (keyno = 1;; ++keyno) {
switch (ret = dbp->get(dbp, NULL, &key, &data, 0)) {
switch (ret = __db_get(dbp, NULL, &key, &data, 0)) {
case 0:
if (data.size != 0 && (u_int32_t)fwrite(
data.data, 1, data.size, fp) != data.size)
if (data.size != 0 &&
fwrite(data.data, 1, data.size, fp) != data.size)
goto write_err;
break;
case DB_KEYEMPTY:
if (F_ISSET(dbp, DB_AM_FIXEDLEN) &&
(u_int32_t)fwrite(pad, 1, t->re_len, fp) !=
t->re_len)
goto write_err;
if (F_ISSET(dbp, DB_AM_FIXEDLEN)) {
if (pad == NULL) {
if ((ret = __os_malloc(
dbenv, t->re_len, &pad)) != 0)
goto err;
memset(pad, t->re_pad, t->re_len);
}
if (fwrite(pad, 1, t->re_len, fp) != t->re_len)
goto write_err;
}
break;
case DB_NOTFOUND:
ret = 0;
......@@ -1114,8 +1126,8 @@ __ram_writeback(dbp)
}
if (!F_ISSET(dbp, DB_AM_FIXEDLEN) &&
fwrite(&delim, 1, 1, fp) != 1) {
write_err: ret = errno;
__db_err(dbp->dbenv,
write_err: ret = __os_get_errno();
__db_err(dbenv,
"%s: write failed to backing file: %s",
t->re_source, strerror(ret));
goto err;
......@@ -1125,13 +1137,14 @@ write_err: ret = errno;
err:
done: /* Close the file descriptor. */
if (fp != NULL && fclose(fp) != 0) {
t_ret = __os_get_errno();
if (ret == 0)
ret = errno;
__db_err(dbenv, "%s: %s", t->re_source, db_strerror(errno));
ret = t_ret;
__db_err(dbenv, "%s: %s", t->re_source, db_strerror(t_ret));
}
/* Discard the cursor. */
if ((t_ret = dbc->c_close(dbc)) != 0 && ret == 0)
if ((t_ret = __db_c_close(dbc)) != 0 && ret == 0)
ret = t_ret;
/* Discard memory allocated to hold the data items. */
......@@ -1259,7 +1272,7 @@ __ram_add(dbc, recnop, data, flags, bi_flags)
u_int32_t flags, bi_flags;
{
BTREE_CURSOR *cp;
int exact, ret, stack;
int exact, ret, stack, t_ret;
cp = (BTREE_CURSOR *)dbc->internal;
......@@ -1270,7 +1283,9 @@ __ram_add(dbc, recnop, data, flags, bi_flags)
stack = 1;
/* Copy the page into the cursor. */
STACK_TO_CURSOR(cp);
STACK_TO_CURSOR(cp, ret);
if (ret != 0)
goto err;
/*
* The application may modify the data based on the selected record
......@@ -1320,8 +1335,8 @@ __ram_add(dbc, recnop, data, flags, bi_flags)
goto err;
}
err: if (stack)
__bam_stkrel(dbc, STK_CLRDBC);
err: if (stack && (t_ret = __bam_stkrel(dbc, STK_CLRDBC)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -35,14 +35,12 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_rsearch.c,v 11.40 2004/07/23 17:21:09 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_rsearch.c,v 11.34 2002/07/03 19:03:50 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#endif
......@@ -52,6 +50,7 @@ static const char revid[] = "$Id: bt_rsearch.c,v 11.34 2002/07/03 19:03:50 bosti
#include "dbinc/btree.h"
#include "dbinc/db_shash.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
/*
* __bam_rsearch --
......@@ -77,11 +76,12 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
db_lockmode_t lock_mode;
db_pgno_t pg;
db_recno_t recno, t_recno, total;
int ret, stack;
int ret, stack, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
h = NULL;
BT_STK_CLR(cp);
......@@ -105,7 +105,7 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
lock_mode = stack ? DB_LOCK_WRITE : DB_LOCK_READ;
if ((ret = __db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
return (ret);
if ((ret = mpf->get(mpf, &pg, 0, &h)) != 0) {
if ((ret = __memp_fget(mpf, &pg, 0, &h)) != 0) {
/* Did not read it, so we can release the lock */
(void)__LPUT(dbc, lock);
return (ret);
......@@ -122,12 +122,15 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
if (!stack &&
((LF_ISSET(S_PARENT) && (u_int8_t)(stop + 1) >= h->level) ||
(LF_ISSET(S_WRITE) && h->level == LEAFLEVEL))) {
(void)mpf->put(mpf, h, 0);
(void)__LPUT(dbc, lock);
ret = __memp_fput(mpf, h, 0);
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
return (ret);
lock_mode = DB_LOCK_WRITE;
if ((ret = __db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
return (ret);
if ((ret = mpf->get(mpf, &pg, 0, &h)) != 0) {
if ((ret = __memp_fget(mpf, &pg, 0, &h)) != 0) {
/* Did not read it, so we can release the lock */
(void)__LPUT(dbc, lock);
return (ret);
......@@ -166,9 +169,11 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
* eliminate any concurrency. A possible fix
* would be to lock the last leaf page instead.
*/
(void)mpf->put(mpf, h, 0);
(void)__TLPUT(dbc, lock);
return (DB_NOTFOUND);
ret = __memp_fput(mpf, h, 0);
if ((t_ret =
__TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
return (ret == 0 ? DB_NOTFOUND : ret);
}
}
}
......@@ -200,7 +205,13 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
*exactp = 0;
if (!LF_ISSET(S_PAST_EOF) ||
recno > t_recno + 1) {
ret = DB_NOTFOUND;
ret = __memp_fput(mpf, h, 0);
h = NULL;
if ((t_ret = __TLPUT(dbc,
lock)) != 0 && ret == 0)
ret = t_ret;
if (ret == 0)
ret = DB_NOTFOUND;
goto err;
}
}
......@@ -262,6 +273,7 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
h = NULL;
lock_mode = DB_LOCK_WRITE;
if ((ret =
......@@ -278,7 +290,9 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
(h->level - 1) == LEAFLEVEL)
stack = 1;
(void)mpf->put(mpf, h, 0);
if ((ret = __memp_fput(mpf, h, 0)) != 0)
goto err;
h = NULL;
lock_mode = stack &&
LF_ISSET(S_WRITE) ? DB_LOCK_WRITE : DB_LOCK_READ;
......@@ -289,18 +303,22 @@ __bam_rsearch(dbc, recnop, flags, stop, exactp)
* is OK because this only happens when we are
* descending the tree holding read-locks.
*/
__LPUT(dbc, lock);
(void)__LPUT(dbc, lock);
goto err;
}
}
if ((ret = mpf->get(mpf, &pg, 0, &h)) != 0)
if ((ret = __memp_fget(mpf, &pg, 0, &h)) != 0)
goto err;
}
/* NOTREACHED */
err: BT_STK_POP(cp);
err: if (h != NULL && (t_ret = __memp_fput(mpf, h, 0)) != 0 && ret == 0)
ret = t_ret;
BT_STK_POP(cp);
__bam_stkrel(dbc, 0);
return (ret);
}
......@@ -352,7 +370,7 @@ __bam_adjust(dbc, adjust)
if (PGNO(h) == root_pgno)
RE_NREC_ADJ(h, adjust);
if ((ret = mpf->set(mpf, h, DB_MPOOL_DIRTY)) != 0)
if ((ret = __memp_fset(mpf, h, DB_MPOOL_DIRTY)) != 0)
return (ret);
}
}
......@@ -375,7 +393,7 @@ __bam_nrecs(dbc, rep)
DB_MPOOLFILE *mpf;
PAGE *h;
db_pgno_t pgno;
int ret;
int ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
......@@ -383,15 +401,16 @@ __bam_nrecs(dbc, rep)
pgno = dbc->internal->root;
if ((ret = __db_lget(dbc, 0, pgno, DB_LOCK_READ, 0, &lock)) != 0)
return (ret);
if ((ret = mpf->get(mpf, &pgno, 0, &h)) != 0)
if ((ret = __memp_fget(mpf, &pgno, 0, &h)) != 0)
return (ret);
*rep = RE_NREC(h);
(void)mpf->put(mpf, h, 0);
(void)__TLPUT(dbc, lock);
ret = __memp_fput(mpf, h, 0);
if ((t_ret = __TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
return (0);
return (ret);
}
/*
......
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -38,14 +38,12 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_search.c,v 11.50 2004/07/23 17:21:09 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_search.c,v 11.43 2002/07/03 19:03:50 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
......@@ -57,6 +55,7 @@ static const char revid[] = "$Id: bt_search.c,v 11.43 2002/07/03 19:03:50 bostic
#include "dbinc/db_shash.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
/*
* __bam_search --
......@@ -84,12 +83,13 @@ __bam_search(dbc, root_pgno, key, flags, stop, recnop, exactp)
db_lockmode_t lock_mode;
db_pgno_t pg;
db_recno_t recno;
int adjust, cmp, deloffset, ret, stack;
int adjust, cmp, deloffset, ret, stack, t_ret;
int (*func) __P((DB *, const DBT *, const DBT *));
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
h = NULL;
t = dbp->bt_internal;
recno = 0;
......@@ -117,7 +117,7 @@ __bam_search(dbc, root_pgno, key, flags, stop, recnop, exactp)
lock_mode = stack ? DB_LOCK_WRITE : DB_LOCK_READ;
if ((ret = __db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
return (ret);
if ((ret = mpf->get(mpf, &pg, 0, &h)) != 0) {
if ((ret = __memp_fget(mpf, &pg, 0, &h)) != 0) {
/* Did not read it, so we can release the lock */
(void)__LPUT(dbc, lock);
return (ret);
......@@ -134,12 +134,15 @@ __bam_search(dbc, root_pgno, key, flags, stop, recnop, exactp)
if (!stack &&
((LF_ISSET(S_PARENT) && (u_int8_t)(stop + 1) >= h->level) ||
(LF_ISSET(S_WRITE) && h->level == LEAFLEVEL))) {
(void)mpf->put(mpf, h, 0);
(void)__LPUT(dbc, lock);
ret = __memp_fput(mpf, h, 0);
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
return (ret);
lock_mode = DB_LOCK_WRITE;
if ((ret = __db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
return (ret);
if ((ret = mpf->get(mpf, &pg, 0, &h)) != 0) {
if ((ret = __memp_fget(mpf, &pg, 0, &h)) != 0) {
/* Did not read it, so we can release the lock */
(void)__LPUT(dbc, lock);
return (ret);
......@@ -148,8 +151,11 @@ __bam_search(dbc, root_pgno, key, flags, stop, recnop, exactp)
(u_int8_t)(stop + 1) >= h->level) ||
(LF_ISSET(S_WRITE) && h->level == LEAFLEVEL))) {
/* Someone else split the root, start over. */
(void)mpf->put(mpf, h, 0);
(void)__LPUT(dbc, lock);
ret = __memp_fput(mpf, h, 0);
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
return (ret);
goto try_again;
}
stack = 1;
......@@ -197,13 +203,19 @@ __bam_search(dbc, root_pgno, key, flags, stop, recnop, exactp)
if (TYPE(h) == P_LBTREE || TYPE(h) == P_LDUP) {
*exactp = 0;
if (LF_ISSET(S_EXACT))
goto notfound;
if (LF_ISSET(S_EXACT)) {
ret = DB_NOTFOUND;
goto err;
}
if (LF_ISSET(S_STK_ONLY)) {
BT_STK_NUM(dbp->dbenv, cp, h, base, ret);
__LPUT(dbc, lock);
(void)mpf->put(mpf, h, 0);
if ((t_ret =
__LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret =
__memp_fput(mpf, h, 0)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
......@@ -243,12 +255,17 @@ next: if (recnop != NULL)
if (LF_ISSET(S_STK_ONLY)) {
if (stop == h->level) {
BT_STK_NUM(dbp->dbenv, cp, h, indx, ret);
__LPUT(dbc, lock);
(void)mpf->put(mpf, h, 0);
if ((t_ret =
__LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret =
__memp_fput(mpf, h, 0)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
BT_STK_NUMPUSH(dbp->dbenv, cp, h, indx, ret);
(void)mpf->put(mpf, h, 0);
(void)__memp_fput(mpf, h, 0);
h = NULL;
if ((ret = __db_lget(dbc,
LCK_COUPLE_ALWAYS, pg, lock_mode, 0, &lock)) != 0) {
/*
......@@ -256,7 +273,7 @@ next: if (recnop != NULL)
* is OK because it only happens when descending
* the tree holding read-locks.
*/
__LPUT(dbc, lock);
(void)__LPUT(dbc, lock);
return (ret);
}
} else if (stack) {
......@@ -272,6 +289,7 @@ next: if (recnop != NULL)
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
h = NULL;
lock_mode = DB_LOCK_WRITE;
if ((ret =
......@@ -288,7 +306,9 @@ next: if (recnop != NULL)
(h->level - 1) == LEAFLEVEL)
stack = 1;
(void)mpf->put(mpf, h, 0);
if ((ret = __memp_fput(mpf, h, 0)) != 0)
goto err;
h = NULL;
lock_mode = stack &&
LF_ISSET(S_WRITE) ? DB_LOCK_WRITE : DB_LOCK_READ;
......@@ -299,25 +319,17 @@ next: if (recnop != NULL)
* is OK because this only happens when we are
* descending the tree holding read-locks.
*/
__LPUT(dbc, lock);
(void)__LPUT(dbc, lock);
goto err;
}
}
if ((ret = mpf->get(mpf, &pg, 0, &h)) != 0)
if ((ret = __memp_fget(mpf, &pg, 0, &h)) != 0)
goto err;
}
/* NOTREACHED */
found: *exactp = 1;
/*
* If we're trying to calculate the record number, add in the
* offset on this page and correct for the fact that records
* in the tree are 0-based.
*/
if (recnop != NULL)
*recnop = recno + (indx / P_INDX) + 1;
/*
* If we got here, we know that we have a Btree leaf or off-page
* duplicates page. If it's a Btree leaf page, we have to handle
......@@ -345,6 +357,7 @@ found: *exactp = 1;
* not move from the original found key on the basis of the S_DELNO
* flag.)
*/
DB_ASSERT(recnop == NULL || LF_ISSET(S_DELNO));
if (LF_ISSET(S_DELNO)) {
deloffset = TYPE(h) == P_LBTREE ? O_INDX : 0;
if (LF_ISSET(S_DUPLAST))
......@@ -363,29 +376,53 @@ found: *exactp = 1;
* If we weren't able to find a non-deleted duplicate, return
* DB_NOTFOUND.
*/
if (B_DISSET(GET_BKEYDATA(dbp, h, indx + deloffset)->type))
goto notfound;
if (B_DISSET(GET_BKEYDATA(dbp, h, indx + deloffset)->type)) {
ret = DB_NOTFOUND;
goto err;
}
/*
* Increment the record counter to point to the found element.
* Ignore any deleted key/data pairs. There doesn't need to
* be any correction for duplicates, as Btree doesn't support
* duplicates and record numbers in the same tree.
*/
if (recnop != NULL) {
DB_ASSERT(TYPE(h) == P_LBTREE);
for (i = 0; i < indx; i += P_INDX)
if (!B_DISSET(
GET_BKEYDATA(dbp, h, i + O_INDX)->type))
++recno;
/* Correct the number for a 0-base. */
*recnop = recno + 1;
}
}
if (LF_ISSET(S_STK_ONLY)) {
BT_STK_NUM(dbp->dbenv, cp, h, indx, ret);
__LPUT(dbc, lock);
(void)mpf->put(mpf, h, 0);
} else {
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __memp_fput(mpf, h, 0)) != 0 && ret == 0)
ret = t_ret;
} else
BT_STK_ENTER(dbp->dbenv, cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
}
if (ret != 0)
goto err;
return (0);
notfound:
/* Keep the page locked for serializability. */
(void)mpf->put(mpf, h, 0);
(void)__TLPUT(dbc, lock);
ret = DB_NOTFOUND;
err: if (h != NULL && (t_ret = __memp_fput(mpf, h, 0)) != 0 && ret == 0)
ret = t_ret;
/* Keep any not-found page locked for serializability. */
if ((t_ret = __TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
err: BT_STK_POP(cp);
BT_STK_POP(cp);
__bam_stkrel(dbc, 0);
return (ret);
}
......@@ -423,7 +460,7 @@ __bam_stkrel(dbc, flags)
LOCK_INIT(cp->lock);
}
if ((t_ret =
mpf->put(mpf, epg->page, 0)) != 0 && ret == 0)
__memp_fput(mpf, epg->page, 0)) != 0 && ret == 0)
ret = t_ret;
/*
* XXX
......@@ -434,10 +471,12 @@ __bam_stkrel(dbc, flags)
*/
epg->page = NULL;
}
if (LF_ISSET(STK_NOLOCK))
(void)__LPUT(dbc, epg->lock);
else
(void)__TLPUT(dbc, epg->lock);
if (LF_ISSET(STK_NOLOCK)) {
if ((t_ret = __LPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
} else
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
}
/* Clear the stack, all pages have been released. */
......
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*/
/*
......@@ -35,18 +35,15 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_split.c,v 11.66 2004/10/01 13:00:21 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_split.c,v 11.58 2002/07/03 19:03:50 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <limits.h>
#include <string.h>
#endif
......@@ -54,6 +51,7 @@ static const char revid[] = "$Id: bt_split.c,v 11.58 2002/07/03 19:03:50 bostic
#include "dbinc/db_page.h"
#include "dbinc/db_shash.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
#include "dbinc/btree.h"
static int __bam_broot __P((DBC *, PAGE *, PAGE *, PAGE *));
......@@ -119,7 +117,7 @@ __bam_split(dbc, arg, root_pgnop)
arg, S_WRPAIR, level, NULL, &exact) :
__bam_rsearch(dbc,
(db_recno_t *)arg, S_WRPAIR, level, &exact))) != 0)
return (ret);
break;
if (root_pgnop != NULL)
*root_pgnop = cp->csp[0].page->pgno == root_pgno ?
......@@ -133,7 +131,7 @@ __bam_split(dbc, arg, root_pgnop)
if (2 * B_MAXSIZEONPAGE(cp->ovflsize)
<= (db_indx_t)P_FREESPACE(dbc->dbp, cp->csp[0].page)) {
__bam_stkrel(dbc, STK_NOLOCK);
return (0);
break;
}
ret = cp->csp[0].page->pgno == root_pgno ?
__bam_root(dbc, &cp->csp[0]) :
......@@ -161,10 +159,13 @@ __bam_split(dbc, arg, root_pgnop)
dir = UP;
break;
default:
return (ret);
goto err;
}
}
/* NOTREACHED */
err: if (root_pgnop != NULL)
*root_pgnop = cp->root;
return (ret);
}
/*
......@@ -183,10 +184,11 @@ __bam_root(dbc, cp)
PAGE *lp, *rp;
db_indx_t split;
u_int32_t opflags;
int ret;
int ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
lp = rp = NULL;
/* Yeah, right. */
if (cp->page->level >= MAXBTREELEVEL) {
......@@ -197,7 +199,6 @@ __bam_root(dbc, cp)
}
/* Create new left and right pages for the split. */
lp = rp = NULL;
if ((ret = __db_new(dbc, TYPE(cp->page), &lp)) != 0 ||
(ret = __db_new(dbc, TYPE(cp->page), &rp)) != 0)
goto err;
......@@ -237,24 +238,21 @@ __bam_root(dbc, cp)
goto err;
/* Adjust any cursors. */
if ((ret = __bam_ca_split(dbc,
cp->page->pgno, lp->pgno, rp->pgno, split, 1)) != 0)
goto err;
ret = __bam_ca_split(dbc, cp->page->pgno, lp->pgno, rp->pgno, split, 1);
/* Success -- write the real pages back to the store. */
(void)mpf->put(mpf, cp->page, DB_MPOOL_DIRTY);
(void)__TLPUT(dbc, cp->lock);
(void)mpf->put(mpf, lp, DB_MPOOL_DIRTY);
(void)mpf->put(mpf, rp, DB_MPOOL_DIRTY);
return (0);
/* Success or error: release pages and locks. */
err: if ((t_ret =
__memp_fput(mpf, cp->page, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, cp->lock)) != 0 && ret == 0)
ret = t_ret;
if (lp != NULL &&
(t_ret = __memp_fput(mpf, lp, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
if (rp != NULL &&
(t_ret = __memp_fput(mpf, rp, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
err: if (lp != NULL)
(void)mpf->put(mpf, lp, 0);
if (rp != NULL)
(void)mpf->put(mpf, rp, 0);
(void)mpf->put(mpf, cp->page, 0);
(void)__TLPUT(dbc, cp->lock);
return (ret);
}
......@@ -358,7 +356,7 @@ __bam_page(dbc, pp, cp)
if ((ret = __db_lget(dbc,
0, NEXT_PGNO(cp->page), DB_LOCK_WRITE, 0, &tplock)) != 0)
goto err;
if ((ret = mpf->get(mpf, &NEXT_PGNO(cp->page), 0, &tp)) != 0)
if ((ret = __memp_fget(mpf, &NEXT_PGNO(cp->page), 0, &tp)) != 0)
goto err;
}
......@@ -370,9 +368,13 @@ __bam_page(dbc, pp, cp)
goto err;
/*
* Lock the new page. We need to do this because someone
* could get here through bt_lpgno if this page was recently
* dealocated. They can't look at it before we commit.
* Lock the new page. We need to do this for two reasons: first, the
* fast-lookup code might have a reference to this page in bt_lpgno if
* the page was recently deleted from the tree, and that code doesn't
* walk the tree and so won't encounter the parent's page lock.
* Second, a dirty reader could get to this page via the parent or old
* page after the split is done but before the transaction is committed
* or aborted.
*/
if ((ret = __db_lget(dbc,
0, PGNO(alloc_rp), DB_LOCK_WRITE, 0, &rplock)) != 0)
......@@ -456,20 +458,27 @@ __bam_page(dbc, pp, cp)
* releasing locks on the pages that reference it. We're finished
* modifying the page so it's not really necessary, but it's neater.
*/
if ((t_ret = mpf->put(mpf, alloc_rp, DB_MPOOL_DIRTY)) != 0 && ret == 0)
if ((t_ret =
__memp_fput(mpf, alloc_rp, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, rplock)) != 0 && ret == 0)
ret = t_ret;
(void)__TLPUT(dbc, rplock);
if ((t_ret = mpf->put(mpf, pp->page, DB_MPOOL_DIRTY)) != 0 && ret == 0)
if ((t_ret =
__memp_fput(mpf, pp->page, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
(void)__TLPUT(dbc, pp->lock);
if ((t_ret = mpf->put(mpf, cp->page, DB_MPOOL_DIRTY)) != 0 && ret == 0)
if ((t_ret = __TLPUT(dbc, pp->lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret =
__memp_fput(mpf, cp->page, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, cp->lock)) != 0 && ret == 0)
ret = t_ret;
(void)__TLPUT(dbc, cp->lock);
if (tp != NULL) {
if ((t_ret =
mpf->put(mpf, tp, DB_MPOOL_DIRTY)) != 0 && ret == 0)
__memp_fput(mpf, tp, DB_MPOOL_DIRTY)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, tplock)) != 0 && ret == 0)
ret = t_ret;
(void)__TLPUT(dbc, tplock);
}
return (ret);
......@@ -478,21 +487,21 @@ err: if (lp != NULL)
if (rp != NULL)
__os_free(dbp->dbenv, rp);
if (alloc_rp != NULL)
(void)mpf->put(mpf, alloc_rp, 0);
(void)__memp_fput(mpf, alloc_rp, 0);
if (tp != NULL)
(void)mpf->put(mpf, tp, 0);
(void)__memp_fput(mpf, tp, 0);
/* We never updated the new or next pages, we can release them. */
(void)__LPUT(dbc, rplock);
(void)__LPUT(dbc, tplock);
(void)mpf->put(mpf, pp->page, 0);
(void)__memp_fput(mpf, pp->page, 0);
if (ret == DB_NEEDSPLIT)
(void)__LPUT(dbc, pp->lock);
else
(void)__TLPUT(dbc, pp->lock);
(void)mpf->put(mpf, cp->page, 0);
(void)__memp_fput(mpf, cp->page, 0);
if (ret == DB_NEEDSPLIT)
(void)__LPUT(dbc, cp->lock);
else
......
This diff is collapsed.
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
* $Id: bt_upgrade.c,v 11.30 2004/01/28 03:35:49 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char revid[] = "$Id: bt_upgrade.c,v 11.25 2002/08/06 06:11:13 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <limits.h>
#include <string.h>
#endif
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/db_am.h"
#include "dbinc/db_upgrade.h"
#include "dbinc/btree.h"
/*
* __bam_30_btreemeta --
......
This diff is collapsed.
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2002
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
* $Id: btree.src,v 10.35 2002/04/17 19:02:56 krinsky Exp $
* $Id: btree.src,v 10.42 2004/06/17 17:35:12 bostic Exp $
*/
PREFIX __bam
DBPRIVATE
INCLUDE #include "db_config.h"
INCLUDE
INCLUDE #ifndef NO_SYSTEM_INCLUDES
INCLUDE #include <sys/types.h>
INCLUDE
......@@ -26,14 +24,9 @@ INCLUDE #include "dbinc/db_dispatch.h"
INCLUDE #include "dbinc/db_am.h"
INCLUDE #include "dbinc/btree.h"
INCLUDE #include "dbinc/log.h"
INCLUDE #include "dbinc/rep.h"
INCLUDE #include "dbinc/txn.h"
INCLUDE
/*
* NOTE: pg_alloc and pg_free have been moved to db.src, where they belong.
*/
/*
* BTREE-split: used to log a page split.
*
......@@ -50,14 +43,14 @@ INCLUDE
*/
BEGIN split 62
DB fileid int32_t ld
WRLOCK left db_pgno_t lu
ARG left db_pgno_t lu
POINTER llsn DB_LSN * lu
WRLOCK right db_pgno_t lu
ARG right db_pgno_t lu
POINTER rlsn DB_LSN * lu
ARG indx u_int32_t lu
ARG npgno db_pgno_t lu
POINTER nlsn DB_LSN * lu
WRLOCKNZ root_pgno db_pgno_t lu
ARG root_pgno db_pgno_t lu
PGDBT pg DBT s
ARG opflags u_int32_t lu
END
......@@ -74,9 +67,9 @@ END
*/
BEGIN rsplit 63
DB fileid int32_t ld
WRLOCK pgno db_pgno_t lu
ARG pgno db_pgno_t lu
PGDBT pgdbt DBT s
WRLOCK root_pgno db_pgno_t lu
ARG root_pgno db_pgno_t lu
ARG nrec db_pgno_t lu
DBT rootent DBT s
POINTER rootlsn DB_LSN * lu
......@@ -93,7 +86,7 @@ END
*/
BEGIN adj 55
DB fileid int32_t ld
WRLOCK pgno db_pgno_t lu
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG indx_copy u_int32_t lu
......@@ -111,7 +104,7 @@ END
*/
BEGIN cadjust 56
DB fileid int32_t ld
WRLOCK pgno db_pgno_t lu
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG adjust int32_t ld
......@@ -127,7 +120,7 @@ END
*/
BEGIN cdel 57
DB fileid int32_t ld
WRLOCK pgno db_pgno_t lu
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
END
......@@ -137,13 +130,16 @@ END
*
* pgno: the page modified.
* lsn: the page's original lsn.
* indx: the index to be replaced.
* isdeleted: set if the record was previously deleted.
* orig: the original data.
* new: the replacement data.
* duplicate: the prefix of the replacement that matches the original.
* repl: the replacement data.
* prefix: the prefix of the replacement that matches the original.
* suffix: the suffix of the replacement that matches the original.
*/
BEGIN repl 58
DB fileid int32_t ld
WRLOCK pgno db_pgno_t lu
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG isdeleted u_int32_t lu
......@@ -158,8 +154,8 @@ END
*/
BEGIN root 59
DB fileid int32_t ld
WRLOCK meta_pgno db_pgno_t lu
WRLOCK root_pgno db_pgno_t lu
ARG meta_pgno db_pgno_t lu
ARG root_pgno db_pgno_t lu
POINTER meta_lsn DB_LSN * lu
END
......@@ -206,3 +202,24 @@ ARG recno db_recno_t ld
/* Order number of the adjustment. */
ARG order u_int32_t ld
END
/*
* BTREE-relink -- Handles relinking around a deleted leaf page.
*
*/
BEGIN relink 147
/* Fileid of db affected. */
DB fileid int32_t ld
/* The page being changed. */
ARG pgno db_pgno_t lu
/* The page's original lsn. */
POINTER lsn DB_LSN * lu
/* The previous page. */
ARG prev db_pgno_t lu
/* The previous page's original lsn. */
POINTER lsn_prev DB_LSN * lu
/* The next page. */
ARG next db_pgno_t lu
/* The previous page's original lsn. */
POINTER lsn_next DB_LSN * lu
END
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996-2004
* Sleepycat Software. All rights reserved.
*
* $Id: db_deadlock.c,v 11.45 2004/03/24 15:13:12 bostic Exp $
*/
#include "db_config.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996-2004\nSleepycat Software Inc. All rights reserved.\n";
#endif
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#endif
#include "db_int.h"
int db_deadlock_main __P((int, char *[]));
int db_deadlock_usage __P((void));
int db_deadlock_version_check __P((const char *));
int
db_deadlock(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_deadlock", args, &argc, &argv);
return (db_deadlock_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_deadlock_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
const char *progname = "db_deadlock";
DB_ENV *dbenv;
u_int32_t atype;
time_t now;
u_long secs, usecs;
int ch, exitval, ret, verbose;
char *home, *logfile, *str;
if ((ret = db_deadlock_version_check(progname)) != 0)
return (ret);
dbenv = NULL;
atype = DB_LOCK_DEFAULT;
home = logfile = NULL;
secs = usecs = 0;
exitval = verbose = 0;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "a:h:L:t:Vvw")) != EOF)
switch (ch) {
case 'a':
switch (optarg[0]) {
case 'e':
atype = DB_LOCK_EXPIRE;
break;
case 'm':
atype = DB_LOCK_MAXLOCKS;
break;
case 'n':
atype = DB_LOCK_MINLOCKS;
break;
case 'o':
atype = DB_LOCK_OLDEST;
break;
case 'W':
atype = DB_LOCK_MAXWRITE;
break;
case 'w':
atype = DB_LOCK_MINWRITE;
break;
case 'y':
atype = DB_LOCK_YOUNGEST;
break;
default:
return (db_deadlock_usage());
/* NOTREACHED */
}
if (optarg[1] != '\0')
return (db_deadlock_usage());
break;
case 'h':
home = optarg;
break;
case 'L':
logfile = optarg;
break;
case 't':
if ((str = strchr(optarg, '.')) != NULL) {
*str++ = '\0';
if (*str != '\0' && __db_getulong(
NULL, progname, str, 0, LONG_MAX, &usecs))
return (EXIT_FAILURE);
}
if (*optarg != '\0' && __db_getulong(
NULL, progname, optarg, 0, LONG_MAX, &secs))
return (EXIT_FAILURE);
if (secs == 0 && usecs == 0)
return (db_deadlock_usage());
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v':
verbose = 1;
break;
case 'w': /* Undocumented. */
/* Detect every 100ms (100000 us) when polling. */
secs = 0;
usecs = 100000;
break;
case '?':
default:
return (db_deadlock_usage());
}
argc -= optind;
argv += optind;
if (argc != 0)
return (db_deadlock_usage());
/* Handle possible interruptions. */
__db_util_siginit();
/* Log our process ID. */
if (logfile != NULL && __db_util_logset(progname, logfile))
goto shutdown;
/*
* Create an environment object and initialize it for error
* reporting.
*/
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
goto shutdown;
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (verbose) {
(void)dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK, 1);
(void)dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR, 1);
}
/* An environment is required. */
if ((ret =
dbenv->open(dbenv, home, DB_INIT_LOCK | DB_USE_ENVIRON, 0)) != 0) {
dbenv->err(dbenv, ret, "open");
goto shutdown;
}
while (!__db_util_interrupted()) {
if (verbose) {
(void)time(&now);
dbenv->errx(dbenv, "running at %.24s", ctime(&now));
}
if ((ret = dbenv->lock_detect(dbenv, 0, atype, NULL)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->lock_detect");
goto shutdown;
}
/* Make a pass every "secs" secs and "usecs" usecs. */
if (secs == 0 && usecs == 0)
break;
__os_sleep(dbenv, secs, usecs);
}
if (0) {
shutdown: exitval = 1;
}
/* Clean up the logfile. */
if (logfile != NULL)
(void)remove(logfile);
/* Clean up the environment. */
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
db_deadlock_usage()
{
(void)fprintf(stderr, "%s\n\t%s\n",
"usage: db_deadlock [-Vv]",
"[-a e | m | n | o | W | w | y] [-h home] [-L file] [-t sec.usec]");
return (EXIT_FAILURE);
}
int
db_deadlock_version_check(progname)
const char *progname;
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}
This diff is collapsed.
......@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "../dbinc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
......@@ -68,7 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /I "../dbinc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
......@@ -92,8 +92,8 @@ LINK32=link.exe
# PROP Intermediate_Dir "Release_static"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "../dbinc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I ".." /I "../dbinc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
......@@ -117,8 +117,8 @@ LINK32=link.exe
# PROP Intermediate_Dir "Debug_static"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /I "../dbinc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "." /I ".." /I "../dbinc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
......
......@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "../dbinc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
......@@ -71,7 +71,7 @@ PostBuild_Cmds=copy Release\*.exe .
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /I "../dbinc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
......
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1999-2002
* Copyright (c) 1999-2004
* Sleepycat Software. All rights reserved.
*
* $Id: dbkill.cpp,v 11.7 2002/01/11 15:51:27 bostic Exp $
* $Id: dbkill.cpp,v 11.9 2004/01/28 03:35:52 bostic Exp $
*/
/*
* Kill -
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment