aboutsummaryrefslogtreecommitdiff
path: root/db2/txn/txn.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-09-30 17:10:40 +0000
committerUlrich Drepper <drepper@redhat.com>1997-09-30 17:10:40 +0000
commita5a0310d8e9d7176bb17e91c916272006a871016 (patch)
treeb922b764878596e6ee42ae84cc315ecaaac00505 /db2/txn/txn.c
parenta2b08ee54130cf3a74655856e6ca6c29874a9df2 (diff)
downloadglibc-a5a0310d8e9d7176bb17e91c916272006a871016.zip
glibc-a5a0310d8e9d7176bb17e91c916272006a871016.tar.gz
glibc-a5a0310d8e9d7176bb17e91c916272006a871016.tar.bz2
1997-09-30 18:03 Ulrich Drepper <drepper@cygnus.com> * Makerules: Undo last change. * csu/Makefile: Define before-compile at the right place. * aclocal.m4: Remove a.out file created by assembler test. * set-init.c: Find set-hooks.h using <...>. Update to db 2.3.10. * db2/Makefile: Update. * db2/db.h: Likewise. * db2/db_185.h: Likewise. * db2/db_int.h: Likewise. * db2/btree/bt_close.c: Likewise. * db2/btree/bt_conv.c: Likewise. * db2/btree/bt_cursor.c: Likewise. * db2/btree/bt_put.c: Likewise. * db2/btree/bt_rec.c: Likewise. * db2/btree/bt_recno.c: Likewise. * db2/btree/btree.src: Likewise. * db2/btree/btree_auto.c: Likewise. * db2/clib/getlong.c: Likewise. * db2/db/db.c: Likewise. * db2/db/db_auto.c: Likewise. * db2/db/db_conv.c: Likewise. * db2/db/db_pr.c: Likewise. * db2/db/db_ret.c: Likewise. * db2/db/db_thread.c: Likewise. * db2/hash/hash.c: Likewise. * db2/hash/hash_auto.c: Likewise. * db2/hash/hash_conv.c: Likewise. * db2/hash/hash_dup.c: Likewise. * db2/hash/hash_func.c: Likewise. * db2/hash/hash_page.c: Likewise. * db2/hash/hash_rec.c: Likewise. * db2/include/btree.h: Likewise. * db2/include/btree_ext.h: Likewise. * db2/include/db.h.src: Likewise. * db2/include/db_185.h.src: Likewise. * db2/include/db_cxx.h: Likewise. * db2/include/db_ext.h: Likewise. * db2/include/db_int.h.src: Likewise. * db2/include/db_page.h: Likewise. * db2/include/db_shash.h: Likewise. * db2/include/lock.h: Likewise. * db2/include/log.h: Likewise. * db2/include/log_ext.h: Likewise. * db2/include/mp.h: Likewise. * db2/include/shqueue.h: Likewise. * db2/include/txn.h: Likewise. * db2/lock/lock.c: Likewise. * db2/lock/lock_deadlock.c: Likewise. * db2/log/log.c: Likewise. * db2/log/log_archive.c: Likewise. * db2/log/log_auto.c: Likewise. * db2/log/log_get.c: Likewise. * db2/log/log_put.c: Likewise. * db2/log/log_register.c: Likewise. * db2/mp/mp_bh.c: Likewise. * db2/mp/mp_fget.c: Likewise. * db2/mp/mp_fopen.c: Likewise. * db2/mp/mp_fput.c: Likewise. * db2/mp/mp_fset.c: Likewise. * db2/mp/mp_open.c: Likewise. * db2/mutex/mutex.c: Likewise. * db2/os/db_os_dir.c: Likewise. * db2/progs/db_checkpoint/db_checkpoint.c: Likewise. * db2/progs/db_deadlock/db_deadlock.c: Likewise. * db2/progs/db_dump185/db_dump185.c: Likewise. * db2/progs/db_load/db_load.c: Likewise. * db2/progs/db_recover/db_recover.c: Likewise. * db2/txn/txn.c: Likewise. * db2/txn/txn_auto.c: Likewise. * elf/link.h: Define struct libname_list outside struct link_map to not confuse C++ compilers. * include/features.h: Recognize _XOPEN_SOURCE == 500 and set __USE_UNIX98. * manual/creature.texi: Explain this. * libc.map: Add new functions. * libio/Makefile (routines): Add fseeko and ftello. * libio/ftello.c: New file. * libio/fseeko.c: New file. * libio/stdio.h: Add prototypes for new functions. * manual/stdio.texi: Document fseeko and ftello. * posix/Makefile (routines): Add pread and pwrite. * sysdeps/posix/pread.c: New file. * sysdeps/posix/pwrite.c: New file. * sysdeps/stub/pread.c: New file. * sysdeps/stub/pwrite.c: New file. * posix/unistd.h: Add prototypes for pread and pwrite. Pretty print header. Define gid_t, uid_t, off_t, pid_t if __USE_UNIX98. Declare ctermid and cuserid if __USE_UNIX98. (swab): Change to take void * arguments. * string/swab.c: Change parameter to void *. * posix/sys/types: Define gid_t, uid_t, off_t, pid_t only if not already happened. * manual/llio.texi: Document pread and pwrite. * string/strings.h: Don't simply include string.h. Define BSD functions according to Unix98. * stdlib/tst-strtol.c: Include <string.h> not <strings.h>. * sunrpc/clnt_simp.c: Likewise. * malloc/Makefile (aux): Add set-freeres. * malloc/mtrace.c: Define function release_libc_mem which calls the __libc_subfreeres handler. (mtrace): Register release_libc_mem. * malloc/set-freeres.c: New file. * intl/dcgettext.c: Define free_mem function and add to __libc_subfreeres list. * intl/finddomain.c: Likewise. * intl/gettextP.h (struct loaded_domain): Add new fields use_mmap and mmap_size. Add prototype for _nl_unloaded_domain. * intl/loadmsgcat.c: Define new function _nl_unload_domain. (_nl_load_domain): Store informaiton about mmap use and file size. * intl/localealias.c (read_alias_file): Optimize locale alias file reading by avoid frequen mallocs. Define free_mem function and add to __libc_subfreeres list. * locale/localeinfo.h: Make a difference between MAX_USAGE_COUNT and undeletable. Add prototype for _nl_unload_locale. * locale/C-collate: Mark data as undeletable by using UNDELETABLE. * locale/C-ctype: Likewise. * locale/C-messages: Likewise. * locale/C-monetary: Likewise. * locale/C-numeric: Likewise. * locale/C-time: Likewise. * locale/findlocale.c (_nl_find_locale, _nl_remove_locale): Handle MAX_USAGE_COUNT and UNDELETABLE. (free_mem): New function. Add it to __libc_subfreeres list. * locale/loadlocale.c: Define _nl_unload_locale function. * misc/hsearch.c: Register hdestroy in __libc_subfreeres list. * stdlib/fmtmsg.c (addseverity): Handle illegal severity arguments correctly Define free_mem function and add to __libc_subfreeres list. * locale/programs/localedef.c (options): short form os verbose is v. Reported by Andreas Jaeger. * misc/sys/select.h: Define pselect only is __USE_POSIX since this header is used in some others as well for historical reasons. * resolv/resolv.h: Include <netinet/in.h> to make self-contained. * string/bits/string2.h: Add missing braces and optimize strcmp a bit more. * sysdeps/i386/i486/bits/string.h: Likewise. * sunrpc/rpc/auth_des.h: Include rpc/auth.h to be self-contained. Pretty print. * sysdeps/mach/hurd/cthreads.c: Add copyright text. * sysdeps/unix/sysv/linux/syscalls.list: Correct prctl entry. * sysdeps/unix/sysv/linux/sys/mman.h: Get definition of size_t. * time/time.h: Pretty print. 1997-09-29 Paul Eggert <eggert@twinsun.com> * time/strftime.c: Synchronize with GNU Emacs strftime.c. (HAVE_MEMCPY): Define if emacs is defined and HAVE_BCOPY isn't. (gmtime_r, localtime_r): Undef before defining. (iso_week_days): Use __inline__, not inline. 1997-09-27 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/bits/mathinline.h: Rename exp2{,l,f} to __ieee754_exp2{,l,f}. * sysdeps/m68k/fpu/s_exp2.c: Likewise. * sysdeps/m68k/fpu/s_exp2l.c: Likewise. * sysdeps/m68k/fpu/s_exp2f.c: Likewise. 1997-09-27 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/soinit.c (__EH_FRAME_BEGIN__): Don't make the .eh_frame section read-only, it contains relocations. * elf/sofini.c (__FRAME_END__): Likewise. 1997-09-29 03:08 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/i486/bits/string.h [__PIC__] (__strspn_cg, __strcspn_cg, __strpbrk_cg, __strstr_cg): Optimize even more. No spill register needed. Patch by NIIBE Yutaka <gniibe@mri.co.jp>. 1997-09-28 08:27 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nis_call.c (__do_niscall2): Fix return code, add missing break in switch case. * nis/nis_mkdir.c: Fix return codes to match Solaris version. * nis/nis_rmdir.c: Likewise. * nis/rpcsvc/yp_prot.h: Rename struct keydat to struct keydat_t for C++. 1997-09-28 04:32 Ulrich Drepper <drepper@cygnus.com> * configure.in: Fix typo. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>. 1997-09-25 20:14 Philip Blundell <Philip.Blundell@pobox.com> * sysdeps/unix/sysv/linux/scsi/sg.h: New file. * sysdeps/unix/sysv/linux/Makefile: Install <scsi/sg.h>.
Diffstat (limited to 'db2/txn/txn.c')
-rw-r--r--db2/txn/txn.c195
1 files changed, 102 insertions, 93 deletions
diff --git a/db2/txn/txn.c b/db2/txn/txn.c
index cb700dc..9a0d626 100644
--- a/db2/txn/txn.c
+++ b/db2/txn/txn.c
@@ -43,16 +43,10 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)txn.c 10.24 (Sleepycat) 9/3/97";
+static const char sccsid[] = "@(#)txn.c 10.30 (Sleepycat) 9/23/97";
#endif /* not lint */
-/*
- * This file contains the top level routines of the transaction library.
- * It assumes that a lock manager and log manager that conform to the db_log(3)
- * and db_lock(3) interfaces exist.
- */
-
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
#include <sys/mman.h>
@@ -87,10 +81,12 @@ static int __txn_undo __P((DB_TXN *));
static int __txn_validate_region __P((DB_TXNMGR *));
/*
+ * This file contains the top level routines of the transaction library.
+ * It assumes that a lock manager and log manager that conform to the db_log(3)
+ * and db_lock(3) interfaces exist.
+ *
* Create and initialize a transaction region in shared memory.
- * 0 means, success.
- * +1 means that the db_create failed, so we did not create the region.
- * -1 means that we got some sort of system error.
+ * Return 0 on success, errno on failure.
*/
static int
__txn_create(dbenv, path, mode)
@@ -99,9 +95,8 @@ __txn_create(dbenv, path, mode)
u_int mode;
{
DB_TXNREGION *txn_region;
- TXN_DETAIL *txnp;
time_t now;
- int fd, i, maxtxns, ret;
+ int fd, maxtxns, ret;
maxtxns = dbenv->tx_max != 0 ? dbenv->tx_max : 1000;
(void)time(&now);
@@ -120,17 +115,12 @@ __txn_create(dbenv, path, mode)
/* XXX If we ever do more types of locking and logging, this changes. */
txn_region->logtype = 0;
txn_region->locktype = 0;
- txn_region->free_txn = 0;
txn_region->time_ckp = now;
ZERO_LSN(txn_region->last_ckp);
ZERO_LSN(txn_region->pending_ckp);
-
- for (txnp = &txn_region->table[0], i = 0; i < maxtxns; i++, txnp++) {
- ZERO_LSN(txnp->begin_lsn);
- txnp->status = TXN_UNALLOC;
- txnp->txnid = i + 1;
- }
- txn_region->table[maxtxns - 1].txnid = TXN_INVALID;
+ SH_TAILQ_INIT(&txn_region->active_txn);
+ __db_shalloc_init((void *)&txn_region[1],
+ TXN_REGION_SIZE(maxtxns) - sizeof(DB_TXNREGION));
/* Unlock the region. */
(void)__db_mutex_unlock(&txn_region->hdr.lock, fd);
@@ -140,7 +130,6 @@ __txn_create(dbenv, path, mode)
(void)txn_unlink(path, 1 /* force */, dbenv);
return (ret);
}
-
return (0);
}
@@ -199,7 +188,7 @@ retry1: if ((ret = __db_ropen(dbenv, DB_APP_NONE, path, DEFAULT_TXN_FILE,
/* Now, create the transaction manager structure and set its fields. */
if ((tmgrp = (DB_TXNMGR *)malloc(sizeof(DB_TXNMGR))) == NULL) {
- __db_err(dbenv, "txn_open: %s", strerror(errno));
+ __db_err(dbenv, "txn_open: %s", strerror(ENOMEM));
ret = ENOMEM;
goto out;
}
@@ -211,9 +200,18 @@ retry1: if ((ret = __db_ropen(dbenv, DB_APP_NONE, path, DEFAULT_TXN_FILE,
tmgrp->reg_size = txn_regionp->hdr.size;
tmgrp->fd = fd;
tmgrp->flags = LF_ISSET(DB_TXN_NOSYNC | DB_THREAD);
+ tmgrp->mem = &txn_regionp[1];
+ tmgrp->mutexp = NULL;
TAILQ_INIT(&tmgrp->txn_chain);
- if (LF_ISSET(DB_THREAD))
- __db_mutex_init(&tmgrp->mutex, -1);
+ if (LF_ISSET(DB_THREAD)) {
+ LOCK_TXNREGION(tmgrp);
+ if ((ret = __db_shalloc(tmgrp->mem, sizeof(db_mutex_t),
+ MUTEX_ALIGNMENT, &tmgrp->mutexp)) == 0)
+ __db_mutex_init(tmgrp->mutexp, -1);
+ UNLOCK_TXNREGION(tmgrp);
+ if (ret != 0)
+ goto out;
+ }
*mgrpp = tmgrp;
return (0);
@@ -221,8 +219,14 @@ out: if (txn_regionp != NULL)
(void)__db_rclose(dbenv, fd, txn_regionp);
if (flags & DB_CREATE)
(void)txn_unlink(path, 1, dbenv);
- if (tmgrp != NULL)
+ if (tmgrp != NULL) {
+ if (tmgrp->mutexp != NULL) {
+ LOCK_TXNREGION(tmgrp);
+ __db_shalloc_free(tmgrp->mem, tmgrp->mutexp);
+ UNLOCK_TXNREGION(tmgrp);
+ }
free(tmgrp);
+ }
return (ret);
}
@@ -239,30 +243,20 @@ txn_begin(tmgrp, parent, txnpp)
{
TXN_DETAIL *txnp;
DB_TXN *retp;
- int id, index, ret;
+ int id, ret;
LOCK_TXNREGION(tmgrp);
- if ((ret = __txn_validate_region(tmgrp)) != 0) {
- UNLOCK_TXNREGION(tmgrp);
- return (ret);
- }
-
- /* Remove element from free list. */
- if (tmgrp->region->free_txn == TXN_INVALID &&
- (ret = __txn_grow_region(tmgrp)) != 0) {
- UNLOCK_TXNREGION(tmgrp);
- return (ret);
- }
-
- index = tmgrp->region->free_txn;
- txnp = &tmgrp->region->table[index];
- tmgrp->region->free_txn = txnp->txnid;
+ if ((ret = __txn_validate_region(tmgrp)) != 0)
+ goto err;
- if (txnp->status != TXN_UNALLOC) {
- UNLOCK_TXNREGION(tmgrp);
- return (EINVAL);
- }
+ /* Allocate a new transaction detail structure. */
+ if ((ret = __db_shalloc(tmgrp->mem, sizeof(TXN_DETAIL), 0, &txnp)) != 0
+ && ret == ENOMEM && (ret = __txn_grow_region(tmgrp)) == 0)
+ ret = __db_shalloc(tmgrp->mem, sizeof(TXN_DETAIL), 0, &txnp);
+
+ if (ret != 0)
+ goto err;
/* Make sure that last_txnid is not going to wrap around. */
if (tmgrp->region->last_txnid == TXN_INVALID)
@@ -270,18 +264,20 @@ txn_begin(tmgrp, parent, txnpp)
if ((retp = (DB_TXN *)malloc(sizeof(DB_TXN))) == NULL) {
__db_err(tmgrp->dbenv, "txn_begin : %s", strerror(ENOMEM));
- UNLOCK_TXNREGION(tmgrp);
- return (ENOMEM);
+ ret = ENOMEM;
+ goto err1;
}
id = ++tmgrp->region->last_txnid;
tmgrp->region->nbegins++;
txnp->txnid = id;
- txnp->last_lock = 0;
- txnp->status = TXN_RUNNING;
ZERO_LSN(txnp->last_lsn);
ZERO_LSN(txnp->begin_lsn);
+ txnp->last_lock = 0;
+ txnp->status = TXN_RUNNING;
+ SH_TAILQ_INSERT_HEAD(&tmgrp->region->active_txn,
+ txnp, links, __txn_detail);
UNLOCK_TXNREGION(tmgrp);
@@ -297,8 +293,9 @@ txn_begin(tmgrp, parent, txnpp)
/* Deallocate transaction. */
LOCK_TXNREGION(tmgrp);
- txnp->txnid = tmgrp->region->free_txn;
- tmgrp->region->free_txn = txnp - &tmgrp->region->table[0];
+ SH_TAILQ_REMOVE(&tmgrp->region->active_txn,
+ txnp, links, __txn_detail);
+ __db_shalloc_free(tmgrp->mem, txnp);
UNLOCK_TXNREGION(tmgrp);
free (retp);
return (ret);
@@ -310,6 +307,12 @@ txn_begin(tmgrp, parent, txnpp)
*txnpp = retp;
return (0);
+
+err1:
+ __db_shalloc_free(tmgrp->mem, txnp);
+err:
+ UNLOCK_TXNREGION(tmgrp);
+ return (ret);
}
/* The db_txn(3) man page describes txn_commit. */
@@ -362,16 +365,15 @@ txn_prepare(txnp)
int ret;
TXN_DETAIL *tp;
- ret = 0;
if ((ret = __txn_check_running(txnp)) != 0)
return (ret);
- if (txnp->mgrp->dbenv->lg_info) {
- ret = log_flush(txnp->mgrp->dbenv->lg_info, &txnp->last_lsn);
- if (ret)
+ if (txnp->mgrp->dbenv->lg_info != NULL) {
+ if ((ret = log_flush(txnp->mgrp->dbenv->lg_info,
+ &txnp->last_lsn)) != 0)
__db_err(txnp->mgrp->dbenv,
"txn_prepare: log_flush failed %s\n",
- strerror(errno));
+ strerror(ret));
return (ret);
}
@@ -420,12 +422,19 @@ txn_close(tmgrp)
ret == 0)
ret = t_ret;
+ if (tmgrp->mutexp != NULL) {
+ LOCK_TXNREGION(tmgrp);
+ __db_shalloc_free(tmgrp->mem, tmgrp->mutexp);
+ UNLOCK_TXNREGION(tmgrp);
+ }
+
if ((t_ret = __db_rclose(tmgrp->dbenv, tmgrp->fd, tmgrp->region)) != 0
&& ret == 0)
ret = t_ret;
if (ret == 0)
free (tmgrp);
+
return (ret);
}
@@ -499,9 +508,8 @@ __txn_end(txnp, is_commit)
/* End the transaction. */
LOCK_TXNREGION(mgr);
tp = (TXN_DETAIL *)((u_int8_t *)mgr->region + txnp->off);
- tp->status = TXN_UNALLOC;
- tp->txnid = mgr->region->free_txn;
- mgr->region->free_txn = tp - &mgr->region->table[0];
+ SH_TAILQ_REMOVE(&mgr->region->active_txn, tp, links, __txn_detail);
+ __db_shalloc_free(mgr->mem, tp);
if (is_commit)
mgr->region->ncommits++;
else
@@ -515,8 +523,9 @@ __txn_end(txnp, is_commit)
/*
- * Undo the transaction with id txnid. Returns 0 on success and sets
- * errno and returns -1 on failure.
+ * __txn_undo --
+ * Undo the transaction with id txnid. Returns 0 on success and
+ * errno on failure.
*/
static int
__txn_undo(txnp)
@@ -576,12 +585,12 @@ __txn_undo(txnp)
int
txn_checkpoint(mgr, kbytes, minutes)
const DB_TXNMGR *mgr;
- long kbytes, minutes;
+ int kbytes, minutes;
{
TXN_DETAIL *txnp;
DB_LSN ckp_lsn, last_ckp;
DB_LOG *dblp;
- u_int32_t bytes_written, i;
+ u_int32_t bytes_written;
time_t last_ckp_time, now;
int ret;
@@ -638,16 +647,16 @@ do_ckp:
if (!IS_ZERO_LSN(mgr->region->pending_ckp))
ckp_lsn = mgr->region->pending_ckp;
else
- for (txnp = &mgr->region->table[0], i = 0;
- i < mgr->region->maxtxns; i++, txnp++) {
+ for (txnp =
+ SH_TAILQ_FIRST(&mgr->region->active_txn, __txn_detail);
+ txnp != NULL;
+ txnp = SH_TAILQ_NEXT(txnp, links, __txn_detail)) {
/*
- * Look through the transaction table for the LSN of
- * the transaction that is in-use (e.g., not
- * TXN_UNALLOC) and whose begin lsn is the lowest.
+ * Look through the active transactions for the
+ * lowest begin lsn.
*/
- if (txnp->status != TXN_UNALLOC &&
- !IS_ZERO_LSN(txnp->begin_lsn) &&
+ if (!IS_ZERO_LSN(txnp->begin_lsn) &&
log_compare(&txnp->begin_lsn, &ckp_lsn) < 0)
ckp_lsn = txnp->begin_lsn;
}
@@ -707,6 +716,7 @@ __txn_validate_region(tp)
return (ret);
tp->reg_size = tp->region->hdr.size;
+ tp->mem = &tp->region[1];
return (0);
}
@@ -715,9 +725,9 @@ static int
__txn_grow_region(tp)
DB_TXNMGR *tp;
{
- TXN_DETAIL *tx;
size_t incr;
- u_int32_t i, oldmax;
+ u_int32_t oldmax;
+ u_int8_t *curaddr;
int ret;
oldmax = tp->region->maxtxns;
@@ -729,19 +739,17 @@ __txn_grow_region(tp)
if ((ret = __db_rremap(tp->dbenv, tp->region,
tp->reg_size, tp->reg_size + incr, tp->fd, &tp->region)) != 0)
return (ret);
+
+ /* Throw the new space on the free list. */
+ curaddr = (u_int8_t *)tp->region + tp->reg_size;
+ tp->mem = &tp->region[1];
tp->reg_size += incr;
- /*
- * Initialize all the new transactions and up the transaction count.
- */
- for (i = 0, tx = &tp->region->table[oldmax]; i < oldmax; i++, tx++) {
- ZERO_LSN(tx->begin_lsn);
- tx->status = TXN_UNALLOC;
- tx->txnid = oldmax + i + 1;
- }
- tp->region->free_txn = oldmax;
+ *((size_t *)curaddr) = incr - sizeof(size_t);
+ curaddr += sizeof(size_t);
+ __db_shalloc_free(tp->mem, curaddr);
+
tp->region->maxtxns = 2 * oldmax;
- tp->region->table[tp->region->maxtxns - 1].txnid = TXN_INVALID;
return (0);
}
@@ -753,8 +761,9 @@ txn_stat(mgr, statp, db_malloc)
void *(*db_malloc) __P((size_t));
{
DB_TXN_STAT *stats;
+ TXN_DETAIL *txnp;
size_t nbytes;
- u_int32_t i, nactive, ndx;
+ u_int32_t nactive, ndx;
LOCK_TXNREGION(mgr);
nactive = mgr->region->nbegins -
@@ -789,17 +798,17 @@ txn_stat(mgr, statp, db_malloc)
stats->st_nactive = nactive + 200;
stats->st_txnarray = (DB_TXN_ACTIVE *)&stats[1];
- for (ndx = 0, i = 0; i < mgr->region->maxtxns; i++)
- if (mgr->region->table[i].status != TXN_UNALLOC) {
- stats->st_txnarray[ndx].txnid =
- mgr->region->table[i].txnid;
- stats->st_txnarray[ndx].lsn =
- mgr->region->table[i].begin_lsn;
- ndx++;
+ ndx = 0;
+ for (txnp = SH_TAILQ_FIRST(&mgr->region->active_txn, __txn_detail);
+ txnp != NULL;
+ txnp = SH_TAILQ_NEXT(txnp, links, __txn_detail)) {
+ stats->st_txnarray[ndx].txnid = txnp->txnid;
+ stats->st_txnarray[ndx].lsn = txnp->begin_lsn;
+ ndx++;
- if (ndx >= stats->st_nactive)
- break;
- }
+ if (ndx >= stats->st_nactive)
+ break;
+ }
UNLOCK_TXNREGION(mgr);
*statp = stats;