mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 09:04:29 +02:00
BDB 4.1.24
BitKeeper/deleted/.del-ex_access.wpj~3df6ae8c99bf7c5f: Delete: bdb/build_vxworks/ex_access/ex_access.wpj BitKeeper/deleted/.del-ex_btrec.wpj~a7622f1c6f432dc6: Delete: bdb/build_vxworks/ex_btrec/ex_btrec.wpj BitKeeper/deleted/.del-ex_dbclient.wpj~7345440f3b204cdd: Delete: bdb/build_vxworks/ex_dbclient/ex_dbclient.wpj BitKeeper/deleted/.del-ex_env.wpj~fbe1ab10b04e8b74: Delete: bdb/build_vxworks/ex_env/ex_env.wpj BitKeeper/deleted/.del-ex_mpool.wpj~4479cfd5c45f327d: Delete: bdb/build_vxworks/ex_mpool/ex_mpool.wpj BitKeeper/deleted/.del-ex_tpcb.wpj~f78093006e14bf41: Delete: bdb/build_vxworks/ex_tpcb/ex_tpcb.wpj BitKeeper/deleted/.del-db_buildall.dsp~bd749ff6da11682: Delete: bdb/build_win32/db_buildall.dsp BitKeeper/deleted/.del-cxx_app.cpp~ad8df8e0791011ed: Delete: bdb/cxx/cxx_app.cpp BitKeeper/deleted/.del-cxx_log.cpp~a50ff3118fe06952: Delete: bdb/cxx/cxx_log.cpp BitKeeper/deleted/.del-cxx_table.cpp~ecd751e79b055556: Delete: bdb/cxx/cxx_table.cpp BitKeeper/deleted/.del-namemap.txt~796a3acd3885d8fd: Delete: bdb/cxx/namemap.txt BitKeeper/deleted/.del-Design.fileop~3ca4da68f1727373: Delete: bdb/db/Design.fileop BitKeeper/deleted/.del-db185_int.h~61bee3736e7959ef: Delete: bdb/db185/db185_int.h BitKeeper/deleted/.del-acconfig.h~411e8854d67ad8b5: Delete: bdb/dist/acconfig.h BitKeeper/deleted/.del-mutex.m4~a13383cde18a64e1: Delete: bdb/dist/aclocal/mutex.m4 BitKeeper/deleted/.del-options.m4~b9d0ca637213750a: Delete: bdb/dist/aclocal/options.m4 BitKeeper/deleted/.del-programs.m4~3ce7890b47732b30: Delete: bdb/dist/aclocal/programs.m4 BitKeeper/deleted/.del-tcl.m4~f944e2db93c3b6db: Delete: bdb/dist/aclocal/tcl.m4 BitKeeper/deleted/.del-types.m4~59cae158c9a32cff: Delete: bdb/dist/aclocal/types.m4 BitKeeper/deleted/.del-script~d38f6d3a4f159cb4: Delete: bdb/dist/build/script BitKeeper/deleted/.del-configure.in~ac795a92c8fe049c: Delete: bdb/dist/configure.in BitKeeper/deleted/.del-ltconfig~66bbd007d8024af: Delete: bdb/dist/ltconfig BitKeeper/deleted/.del-rec_ctemp~a28554362534f00a: Delete: bdb/dist/rec_ctemp BitKeeper/deleted/.del-s_tcl~2ffe4326459fcd9f: Delete: bdb/dist/s_tcl BitKeeper/deleted/.del-.IGNORE_ME~d8148b08fa7d5d15: Delete: bdb/dist/template/.IGNORE_ME BitKeeper/deleted/.del-btree.h~179f2aefec1753d: Delete: bdb/include/btree.h BitKeeper/deleted/.del-cxx_int.h~6b649c04766508f8: Delete: bdb/include/cxx_int.h BitKeeper/deleted/.del-db.src~6b433ae615b16a8d: Delete: bdb/include/db.src BitKeeper/deleted/.del-db_185.h~ad8b373d9391d35c: Delete: bdb/include/db_185.h BitKeeper/deleted/.del-db_am.h~a714912b6b75932f: Delete: bdb/include/db_am.h BitKeeper/deleted/.del-db_cxx.h~fcafadf45f5d19e9: Delete: bdb/include/db_cxx.h BitKeeper/deleted/.del-db_dispatch.h~6844f20f7eb46904: Delete: bdb/include/db_dispatch.h BitKeeper/deleted/.del-db_int.src~419a3f48b6a01da7: Delete: bdb/include/db_int.src BitKeeper/deleted/.del-db_join.h~76f9747a42c3399a: Delete: bdb/include/db_join.h BitKeeper/deleted/.del-db_page.h~e302ca3a4db3abdc: Delete: bdb/include/db_page.h BitKeeper/deleted/.del-db_server_int.h~e1d20b6ba3bca1ab: Delete: bdb/include/db_server_int.h BitKeeper/deleted/.del-db_shash.h~5fbf2d696fac90f3: Delete: bdb/include/db_shash.h BitKeeper/deleted/.del-db_swap.h~1e60887550864a59: Delete: bdb/include/db_swap.h BitKeeper/deleted/.del-db_upgrade.h~c644eee73701fc8d: Delete: bdb/include/db_upgrade.h BitKeeper/deleted/.del-db_verify.h~b8d6c297c61f342e: Delete: bdb/include/db_verify.h BitKeeper/deleted/.del-debug.h~dc2b4f2cf27ccebc: Delete: bdb/include/debug.h BitKeeper/deleted/.del-hash.h~2aaa548b28882dfb: Delete: bdb/include/hash.h BitKeeper/deleted/.del-lock.h~a761c1b7de57b77f: Delete: bdb/include/lock.h BitKeeper/deleted/.del-log.h~ff20184238e35e4d: Delete: bdb/include/log.h BitKeeper/deleted/.del-mp.h~7e317597622f3411: Delete: bdb/include/mp.h BitKeeper/deleted/.del-mutex.h~d3ae7a2977a68137: Delete: bdb/include/mutex.h BitKeeper/deleted/.del-os.h~91867cc8757cd0e3: Delete: bdb/include/os.h BitKeeper/deleted/.del-os_jump.h~e1b939fa5151d4be: Delete: bdb/include/os_jump.h BitKeeper/deleted/.del-qam.h~6fad0c1b5723d597: Delete: bdb/include/qam.h BitKeeper/deleted/.del-queue.h~4c72c0826c123d5: Delete: bdb/include/queue.h BitKeeper/deleted/.del-region.h~513fe04d977ca0fc: Delete: bdb/include/region.h BitKeeper/deleted/.del-shqueue.h~525fc3e6c2025c36: Delete: bdb/include/shqueue.h BitKeeper/deleted/.del-tcl_db.h~c536fd61a844f23f: Delete: bdb/include/tcl_db.h BitKeeper/deleted/.del-txn.h~c8d94b221ec147e4: Delete: bdb/include/txn.h BitKeeper/deleted/.del-xa.h~ecc466493aae9d9a: Delete: bdb/include/xa.h BitKeeper/deleted/.del-DbRecoveryInit.java~756b52601a0b9023: Delete: bdb/java/src/com/sleepycat/db/DbRecoveryInit.java BitKeeper/deleted/.del-DbTxnRecover.java~74607cba7ab89d6d: Delete: bdb/java/src/com/sleepycat/db/DbTxnRecover.java BitKeeper/deleted/.del-lock_conflict.c~fc5e0f14cf597a2b: Delete: bdb/lock/lock_conflict.c BitKeeper/deleted/.del-log.src~53ac9e7b5cb023f2: Delete: bdb/log/log.src BitKeeper/deleted/.del-log_findckp.c~24287f008916e81f: Delete: bdb/log/log_findckp.c BitKeeper/deleted/.del-log_rec.c~d51711f2cac09297: Delete: bdb/log/log_rec.c BitKeeper/deleted/.del-log_register.c~b40bb4efac75ca15: Delete: bdb/log/log_register.c BitKeeper/deleted/.del-Design~b3d0f179f2767b: Delete: bdb/mp/Design BitKeeper/deleted/.del-os_finit.c~95dbefc6fe79b26c: Delete: bdb/os/os_finit.c BitKeeper/deleted/.del-os_abs.c~df95d1e7db81924: Delete: bdb/os_vxworks/os_abs.c BitKeeper/deleted/.del-os_finit.c~803b484bdb9d0122: Delete: bdb/os_vxworks/os_finit.c BitKeeper/deleted/.del-os_map.c~3a6d7926398b76d3: Delete: bdb/os_vxworks/os_map.c BitKeeper/deleted/.del-os_finit.c~19a227c6d3c78ad: Delete: bdb/os_win32/os_finit.c BitKeeper/deleted/.del-log-corruption.patch~1cf2ecc7c6408d5d: Delete: bdb/patches/log-corruption.patch BitKeeper/deleted/.del-Btree.pm~af6d0c5eaed4a98e: Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Btree.pm BitKeeper/deleted/.del-BerkeleyDB.pm~7244036d4482643: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pm BitKeeper/deleted/.del-BerkeleyDB.pod~e7b18fd6132448e3: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod BitKeeper/deleted/.del-Hash.pm~10292a26c06a5c95: Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Hash.pm BitKeeper/deleted/.del-BerkeleyDB.pod.P~79f76a1495eda203: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod.P BitKeeper/deleted/.del-BerkeleyDB.xs~80c99afbd98e392c: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.xs BitKeeper/deleted/.del-Changes~729c1891efa60de9: Delete: bdb/perl.BerkeleyDB/Changes BitKeeper/deleted/.del-MANIFEST~63a1e34aecf157a0: Delete: bdb/perl.BerkeleyDB/MANIFEST BitKeeper/deleted/.del-Makefile.PL~c68797707d8df87a: Delete: bdb/perl.BerkeleyDB/Makefile.PL BitKeeper/deleted/.del-README~5f2f579b1a241407: Delete: bdb/perl.BerkeleyDB/README BitKeeper/deleted/.del-Todo~dca3c66c193adda9: Delete: bdb/perl.BerkeleyDB/Todo BitKeeper/deleted/.del-config.in~ae81681e450e0999: Delete: bdb/perl.BerkeleyDB/config.in BitKeeper/deleted/.del-dbinfo~28ad67d83be4f68e: Delete: bdb/perl.BerkeleyDB/dbinfo BitKeeper/deleted/.del-mkconsts~543ab60669c7a04e: Delete: bdb/perl.BerkeleyDB/mkconsts BitKeeper/deleted/.del-mkpod~182c0ca54e439afb: Delete: bdb/perl.BerkeleyDB/mkpod BitKeeper/deleted/.del-5.004~e008cb5a48805543: Delete: bdb/perl.BerkeleyDB/patches/5.004 BitKeeper/deleted/.del-irix_6_5.pl~61662bb08afcdec8: Delete: bdb/perl.BerkeleyDB/hints/irix_6_5.pl BitKeeper/deleted/.del-solaris.pl~6771e7182394e152: Delete: bdb/perl.BerkeleyDB/hints/solaris.pl BitKeeper/deleted/.del-typemap~783b8f5295b05f3d: Delete: bdb/perl.BerkeleyDB/typemap BitKeeper/deleted/.del-5.004_01~6081ce2fff7b0bc: Delete: bdb/perl.BerkeleyDB/patches/5.004_01 BitKeeper/deleted/.del-5.004_02~87214eac35ad9e6: Delete: bdb/perl.BerkeleyDB/patches/5.004_02 BitKeeper/deleted/.del-5.004_03~9a672becec7cb40f: Delete: bdb/perl.BerkeleyDB/patches/5.004_03 BitKeeper/deleted/.del-5.004_04~e326cb51af09d154: Delete: bdb/perl.BerkeleyDB/patches/5.004_04 BitKeeper/deleted/.del-5.004_05~7ab457a1e41a92fe: Delete: bdb/perl.BerkeleyDB/patches/5.004_05 BitKeeper/deleted/.del-5.005~f9e2d59b5964cd4b: Delete: bdb/perl.BerkeleyDB/patches/5.005 BitKeeper/deleted/.del-5.005_01~3eb9fb7b5842ea8e: Delete: bdb/perl.BerkeleyDB/patches/5.005_01 BitKeeper/deleted/.del-5.005_02~67477ce0bef717cb: Delete: bdb/perl.BerkeleyDB/patches/5.005_02 BitKeeper/deleted/.del-5.005_03~c4c29a1fb21e290a: Delete: bdb/perl.BerkeleyDB/patches/5.005_03 BitKeeper/deleted/.del-5.6.0~e1fb9897d124ee22: Delete: bdb/perl.BerkeleyDB/patches/5.6.0 BitKeeper/deleted/.del-btree.t~e4a1a3c675ddc406: Delete: bdb/perl.BerkeleyDB/t/btree.t BitKeeper/deleted/.del-db-3.0.t~d2c60991d84558f2: Delete: bdb/perl.BerkeleyDB/t/db-3.0.t BitKeeper/deleted/.del-db-3.1.t~6ee88cd13f55e018: Delete: bdb/perl.BerkeleyDB/t/db-3.1.t BitKeeper/deleted/.del-db-3.2.t~f73b6461f98fd1cf: Delete: bdb/perl.BerkeleyDB/t/db-3.2.t BitKeeper/deleted/.del-destroy.t~cc6a2ae1980a2ecd: Delete: bdb/perl.BerkeleyDB/t/destroy.t BitKeeper/deleted/.del-env.t~a8604a4499c4bd07: Delete: bdb/perl.BerkeleyDB/t/env.t BitKeeper/deleted/.del-examples.t~2571b77c3cc75574: Delete: bdb/perl.BerkeleyDB/t/examples.t BitKeeper/deleted/.del-examples.t.T~8228bdd75ac78b88: Delete: bdb/perl.BerkeleyDB/t/examples.t.T BitKeeper/deleted/.del-examples3.t.T~66a186897a87026d: Delete: bdb/perl.BerkeleyDB/t/examples3.t.T BitKeeper/deleted/.del-examples3.t~fe3822ba2f2d7f83: Delete: bdb/perl.BerkeleyDB/t/examples3.t BitKeeper/deleted/.del-filter.t~f87b045c1b708637: Delete: bdb/perl.BerkeleyDB/t/filter.t BitKeeper/deleted/.del-hash.t~616bfb4d644de3a3: Delete: bdb/perl.BerkeleyDB/t/hash.t BitKeeper/deleted/.del-join.t~29fc39f74a83ca22: Delete: bdb/perl.BerkeleyDB/t/join.t BitKeeper/deleted/.del-mldbm.t~31f5015341eea040: Delete: bdb/perl.BerkeleyDB/t/mldbm.t BitKeeper/deleted/.del-queue.t~8f338034ce44a641: Delete: bdb/perl.BerkeleyDB/t/queue.t BitKeeper/deleted/.del-recno.t~d4ddbd3743add63e: Delete: bdb/perl.BerkeleyDB/t/recno.t BitKeeper/deleted/.del-strict.t~6885cdd2ea71ca2d: Delete: bdb/perl.BerkeleyDB/t/strict.t BitKeeper/deleted/.del-subdb.t~aab62a5d5864c603: Delete: bdb/perl.BerkeleyDB/t/subdb.t BitKeeper/deleted/.del-txn.t~65033b8558ae1216: Delete: bdb/perl.BerkeleyDB/t/txn.t BitKeeper/deleted/.del-unknown.t~f3710458682665e1: Delete: bdb/perl.BerkeleyDB/t/unknown.t BitKeeper/deleted/.del-Changes~436f74a5c414c65b: Delete: bdb/perl.DB_File/Changes BitKeeper/deleted/.del-DB_File.pm~ae0951c6c7665a82: Delete: bdb/perl.DB_File/DB_File.pm BitKeeper/deleted/.del-DB_File.xs~89e49a0b5556f1d8: Delete: bdb/perl.DB_File/DB_File.xs BitKeeper/deleted/.del-DB_File_BS~290fad5dbbb87069: Delete: bdb/perl.DB_File/DB_File_BS BitKeeper/deleted/.del-MANIFEST~90ee581572bdd4ac: Delete: bdb/perl.DB_File/MANIFEST BitKeeper/deleted/.del-Makefile.PL~ac0567bb5a377e38: Delete: bdb/perl.DB_File/Makefile.PL BitKeeper/deleted/.del-README~77e924a5a9bae6b3: Delete: bdb/perl.DB_File/README BitKeeper/deleted/.del-config.in~ab4c2792b86a810b: Delete: bdb/perl.DB_File/config.in BitKeeper/deleted/.del-dbinfo~461c43b30fab2cb: Delete: bdb/perl.DB_File/dbinfo BitKeeper/deleted/.del-dynixptx.pl~50dcddfae25d17e9: Delete: bdb/perl.DB_File/hints/dynixptx.pl BitKeeper/deleted/.del-typemap~55cffb3288a9e587: Delete: bdb/perl.DB_File/typemap BitKeeper/deleted/.del-version.c~a4df0e646f8b3975: Delete: bdb/perl.DB_File/version.c BitKeeper/deleted/.del-5.004_01~d6830d0082702af7: Delete: bdb/perl.DB_File/patches/5.004_01 BitKeeper/deleted/.del-5.004_02~78b082dc80c91031: Delete: bdb/perl.DB_File/patches/5.004_02 BitKeeper/deleted/.del-5.004~4411ec2e3c9e008b: Delete: bdb/perl.DB_File/patches/5.004 BitKeeper/deleted/.del-sco.pl~1e795fe14fe4dcfe: Delete: bdb/perl.DB_File/hints/sco.pl BitKeeper/deleted/.del-5.004_03~33f274648b160d95: Delete: bdb/perl.DB_File/patches/5.004_03 BitKeeper/deleted/.del-5.004_04~8f3d1b3cf18bb20a: Delete: bdb/perl.DB_File/patches/5.004_04 BitKeeper/deleted/.del-5.004_05~9c0f02e7331e142: Delete: bdb/perl.DB_File/patches/5.004_05 BitKeeper/deleted/.del-5.005~c2108cb2e3c8d951: Delete: bdb/perl.DB_File/patches/5.005 BitKeeper/deleted/.del-5.005_01~3b45e9673afc4cfa: Delete: bdb/perl.DB_File/patches/5.005_01 BitKeeper/deleted/.del-5.005_02~9fe5766bb02a4522: Delete: bdb/perl.DB_File/patches/5.005_02 BitKeeper/deleted/.del-5.005_03~ffa1c38c19ae72ea: Delete: bdb/perl.DB_File/patches/5.005_03 BitKeeper/deleted/.del-5.6.0~373be3a5ce47be85: Delete: bdb/perl.DB_File/patches/5.6.0 BitKeeper/deleted/.del-db-btree.t~3231595a1c241eb3: Delete: bdb/perl.DB_File/t/db-btree.t BitKeeper/deleted/.del-db-hash.t~7c4ad0c795c7fad2: Delete: bdb/perl.DB_File/t/db-hash.t BitKeeper/deleted/.del-db-recno.t~6c2d3d80b9ba4a50: Delete: bdb/perl.DB_File/t/db-recno.t BitKeeper/deleted/.del-db_server.sed~cdb00ebcd48a64e2: Delete: bdb/rpc_server/db_server.sed BitKeeper/deleted/.del-db_server_proc.c~d46c8f409c3747f4: Delete: bdb/rpc_server/db_server_proc.c BitKeeper/deleted/.del-db_server_svc.sed~3f5e59f334fa4607: Delete: bdb/rpc_server/db_server_svc.sed BitKeeper/deleted/.del-db_server_util.c~a809f3a4629acda: Delete: bdb/rpc_server/db_server_util.c BitKeeper/deleted/.del-log.tcl~ff1b41f1355b97d7: Delete: bdb/test/log.tcl BitKeeper/deleted/.del-mpool.tcl~b0df4dc1b04db26c: Delete: bdb/test/mpool.tcl BitKeeper/deleted/.del-mutex.tcl~52fd5c73a150565: Delete: bdb/test/mutex.tcl BitKeeper/deleted/.del-txn.tcl~c4ff071550b5446e: Delete: bdb/test/txn.tcl BitKeeper/deleted/.del-README~e800a12a5392010a: Delete: bdb/test/upgrade/README BitKeeper/deleted/.del-pack-2.6.6.pl~89d5076d758d3e98: Delete: bdb/test/upgrade/generate-2.X/pack-2.6.6.pl BitKeeper/deleted/.del-test-2.6.patch~4a52dc83d447547b: Delete: bdb/test/upgrade/generate-2.X/test-2.6.patch
This commit is contained in:
parent
b8798d25ab
commit
155e78f014
1191 changed files with 170446 additions and 57453 deletions
1171
bdb/txn/txn.c
1171
bdb/txn/txn.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +1,14 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1996-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*
|
||||
* $Id: txn.src,v 11.10 2001/01/02 00:58:33 margo Exp $
|
||||
* $Id: txn.src,v 11.19 2002/03/27 04:33:15 bostic Exp $
|
||||
*/
|
||||
|
||||
PREFIX txn
|
||||
PREFIX __txn
|
||||
DBPRIVATE
|
||||
|
||||
INCLUDE #include "db_config.h"
|
||||
INCLUDE
|
||||
|
|
@ -15,24 +16,19 @@ INCLUDE #ifndef NO_SYSTEM_INCLUDES
|
|||
INCLUDE #include <sys/types.h>
|
||||
INCLUDE
|
||||
INCLUDE #include <ctype.h>
|
||||
INCLUDE #include <errno.h>
|
||||
INCLUDE #include <string.h>
|
||||
INCLUDE #endif
|
||||
INCLUDE
|
||||
INCLUDE #include "db_int.h"
|
||||
INCLUDE #include "db_page.h"
|
||||
INCLUDE #include "db_dispatch.h"
|
||||
INCLUDE #include "db_am.h"
|
||||
INCLUDE #include "txn.h"
|
||||
INCLUDE #include "dbinc/crypto.h"
|
||||
INCLUDE #include "dbinc/db_page.h"
|
||||
INCLUDE #include "dbinc/db_dispatch.h"
|
||||
INCLUDE #include "dbinc/db_am.h"
|
||||
INCLUDE #include "dbinc/log.h"
|
||||
INCLUDE #include "dbinc/rep.h"
|
||||
INCLUDE #include "dbinc/txn.h"
|
||||
INCLUDE
|
||||
|
||||
/*
|
||||
* DEPRECATED in 3.1 to add timestamps.
|
||||
*/
|
||||
DEPRECATED old_regop 6
|
||||
ARG opcode u_int32_t lu
|
||||
END
|
||||
|
||||
/*
|
||||
* This is the standard log operation for commit.
|
||||
* Note that we are using an int32_t for the timestamp. This means that
|
||||
|
|
@ -44,11 +40,6 @@ ARG opcode u_int32_t lu
|
|||
ARG timestamp int32_t ld
|
||||
END
|
||||
|
||||
DEPRECATED old_ckp 7
|
||||
POINTER ckp_lsn DB_LSN * lu
|
||||
POINTER last_ckp DB_LSN * lu
|
||||
END
|
||||
|
||||
/*
|
||||
* This is the checkpoint record. It contains the lsn that the checkpoint
|
||||
* guarantees and a pointer to the last checkpoint so we can walk backwards
|
||||
|
|
@ -70,20 +61,19 @@ ARG timestamp int32_t ld
|
|||
END
|
||||
|
||||
/*
|
||||
* This is the standard log operation for prepare (since right now
|
||||
* we only use prepare in an XA environment).
|
||||
* This is the (new) log operation for a child commit. It is
|
||||
* logged as a record in the PARENT. The child field contains
|
||||
* the transaction ID of the child committing and the c_lsn is
|
||||
* the last LSN of the child's log trail.
|
||||
*/
|
||||
DEPRECATED xa_regop_old 8
|
||||
ARG opcode u_int32_t lu
|
||||
DBT xid DBT s
|
||||
ARG formatID int32_t ld
|
||||
ARG gtrid u_int32_t u
|
||||
ARG bqual u_int32_t u
|
||||
BEGIN child 12
|
||||
ARG child u_int32_t lx
|
||||
POINTER c_lsn DB_LSN * lu
|
||||
END
|
||||
|
||||
|
||||
/*
|
||||
* This is the standard log operation for prepare (since right now
|
||||
* we only use prepare in an XA environment).
|
||||
* This is the standard log operation for prepare.
|
||||
*/
|
||||
BEGIN xa_regop 13
|
||||
ARG opcode u_int32_t lu
|
||||
|
|
@ -95,20 +85,9 @@ POINTER begin_lsn DB_LSN * lu
|
|||
END
|
||||
|
||||
/*
|
||||
* This is the log operation for a child commit.
|
||||
* Log the fact that we are recycling txnids.
|
||||
*/
|
||||
DEPRECATED child_old 9
|
||||
ARG opcode u_int32_t lu
|
||||
ARG parent u_int32_t lx
|
||||
END
|
||||
|
||||
/*
|
||||
* This is the (new) log operation for a child commit. It is
|
||||
* logged as a record in the PARENT. The child field contains
|
||||
* the transaction ID of the child committing and the c_lsn is
|
||||
* the last LSN of the child's log trail.
|
||||
*/
|
||||
BEGIN child 12
|
||||
ARG child u_int32_t lx
|
||||
POINTER c_lsn DB_LSN * lu
|
||||
BEGIN recycle 14
|
||||
ARG min u_int32_t u
|
||||
ARG max u_int32_t u
|
||||
END
|
||||
|
|
|
|||
105
bdb/txn/txn_method.c
Normal file
105
bdb/txn/txn_method.c
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1996-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: txn_method.c,v 11.62 2002/05/09 20:09:35 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef NO_SYSTEM_INCLUDES
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
#include <rpc/rpc.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "dbinc/txn.h"
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
#include "dbinc_auto/db_server.h"
|
||||
#include "dbinc_auto/rpc_client_ext.h"
|
||||
#endif
|
||||
|
||||
static int __txn_set_tx_max __P((DB_ENV *, u_int32_t));
|
||||
static int __txn_set_tx_timestamp __P((DB_ENV *, time_t *));
|
||||
|
||||
/*
|
||||
* __txn_dbenv_create --
|
||||
* Transaction specific initialization of the DB_ENV structure.
|
||||
*
|
||||
* PUBLIC: void __txn_dbenv_create __P((DB_ENV *));
|
||||
*/
|
||||
void
|
||||
__txn_dbenv_create(dbenv)
|
||||
DB_ENV *dbenv;
|
||||
{
|
||||
/*
|
||||
* !!!
|
||||
* Our caller has not yet had the opportunity to reset the panic
|
||||
* state or turn off mutex locking, and so we can neither check
|
||||
* the panic state or acquire a mutex in the DB_ENV create path.
|
||||
*/
|
||||
|
||||
dbenv->tx_max = DEF_MAX_TXNS;
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
if (F_ISSET(dbenv, DB_ENV_RPCCLIENT)) {
|
||||
dbenv->set_tx_max = __dbcl_set_tx_max;
|
||||
dbenv->set_tx_timestamp = __dbcl_set_tx_timestamp;
|
||||
dbenv->txn_checkpoint = __dbcl_txn_checkpoint;
|
||||
dbenv->txn_recover = __dbcl_txn_recover;
|
||||
dbenv->txn_stat = __dbcl_txn_stat;
|
||||
dbenv->txn_begin = __dbcl_txn_begin;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
dbenv->set_tx_max = __txn_set_tx_max;
|
||||
dbenv->set_tx_timestamp = __txn_set_tx_timestamp;
|
||||
dbenv->txn_checkpoint = __txn_checkpoint;
|
||||
#ifdef CONFIG_TEST
|
||||
dbenv->txn_id_set = __txn_id_set;
|
||||
#endif
|
||||
dbenv->txn_recover = __txn_recover;
|
||||
dbenv->txn_stat = __txn_stat;
|
||||
dbenv->txn_begin = __txn_begin;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_set_tx_max --
|
||||
* Set the size of the transaction table.
|
||||
*/
|
||||
static int
|
||||
__txn_set_tx_max(dbenv, tx_max)
|
||||
DB_ENV *dbenv;
|
||||
u_int32_t tx_max;
|
||||
{
|
||||
ENV_ILLEGAL_AFTER_OPEN(dbenv, "set_tx_max");
|
||||
|
||||
dbenv->tx_max = tx_max;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_set_tx_timestamp --
|
||||
* Set the transaction recovery timestamp.
|
||||
*/
|
||||
static int
|
||||
__txn_set_tx_timestamp(dbenv, timestamp)
|
||||
DB_ENV *dbenv;
|
||||
time_t *timestamp;
|
||||
{
|
||||
ENV_ILLEGAL_AFTER_OPEN(dbenv, "set_tx_timestamp");
|
||||
|
||||
dbenv->tx_timestamp = *timestamp;
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1996-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
|
|
@ -36,23 +36,20 @@
|
|||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: txn_rec.c,v 11.15 2001/01/11 18:19:55 bostic Exp $";
|
||||
static const char revid[] = "$Id: txn_rec.c,v 11.41 2002/08/06 04:42:37 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef NO_SYSTEM_INCLUDES
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "db_page.h"
|
||||
#include "txn.h"
|
||||
#include "db_am.h"
|
||||
#include "db_dispatch.h"
|
||||
#include "log.h"
|
||||
#include "common_ext.h"
|
||||
|
||||
static int __txn_restore_txn __P((DB_ENV *, DB_LSN *, __txn_xa_regop_args *));
|
||||
#include "dbinc/db_page.h"
|
||||
#include "dbinc/txn.h"
|
||||
#include "dbinc/db_am.h"
|
||||
#include "dbinc/db_dispatch.h"
|
||||
|
||||
#define IS_XA_TXN(R) (R->xid.size != 0)
|
||||
|
||||
|
|
@ -72,6 +69,7 @@ __txn_regop_recover(dbenv, dbtp, lsnp, op, info)
|
|||
db_recops op;
|
||||
void *info;
|
||||
{
|
||||
DB_TXNHEAD *headp;
|
||||
__txn_regop_args *argp;
|
||||
int ret;
|
||||
|
||||
|
|
@ -82,31 +80,62 @@ __txn_regop_recover(dbenv, dbtp, lsnp, op, info)
|
|||
if ((ret = __txn_regop_read(dbenv, dbtp->data, &argp)) != 0)
|
||||
return (ret);
|
||||
|
||||
if (argp->opcode != TXN_COMMIT) {
|
||||
ret = EINVAL;
|
||||
goto err;
|
||||
}
|
||||
headp = info;
|
||||
/*
|
||||
* We are only ever called during FORWARD_ROLL or BACKWARD_ROLL.
|
||||
* We check for the former explicitly and the last two clauses
|
||||
* apply to the BACKWARD_ROLL case.
|
||||
*/
|
||||
|
||||
if (op == DB_TXN_FORWARD_ROLL)
|
||||
ret = __db_txnlist_remove(info, argp->txnid->txnid);
|
||||
else if (dbenv->tx_timestamp == 0 ||
|
||||
argp->timestamp <= (int32_t)dbenv->tx_timestamp)
|
||||
/*
|
||||
* We know this is the backward roll case because we
|
||||
* are never called during ABORT or OPENFILES.
|
||||
* If this was a 2-phase-commit transaction, then it
|
||||
* might already have been removed from the list, and
|
||||
* that's OK. Ignore the return code from remove.
|
||||
*/
|
||||
ret = __db_txnlist_add(dbenv, info, argp->txnid->txnid, 0);
|
||||
else
|
||||
(void)__db_txnlist_remove(dbenv, info, argp->txnid->txnid);
|
||||
else if ((dbenv->tx_timestamp != 0 &&
|
||||
argp->timestamp > (int32_t)dbenv->tx_timestamp) ||
|
||||
(!IS_ZERO_LSN(headp->trunc_lsn) &&
|
||||
log_compare(&headp->trunc_lsn, lsnp) < 0)) {
|
||||
/*
|
||||
* This is commit record, but we failed the timestamp check
|
||||
* so we should treat it as an abort and add it to the list
|
||||
* as an aborted record.
|
||||
* We failed either the timestamp check or the trunc_lsn check,
|
||||
* so we treat this as an abort even if it was a commit record.
|
||||
*/
|
||||
ret = __db_txnlist_add(dbenv, info, argp->txnid->txnid, 1);
|
||||
ret = __db_txnlist_update(dbenv,
|
||||
info, argp->txnid->txnid, TXN_ABORT, NULL);
|
||||
|
||||
if (ret == TXN_NOTFOUND)
|
||||
ret = __db_txnlist_add(dbenv,
|
||||
info, argp->txnid->txnid, TXN_IGNORE, NULL);
|
||||
else if (ret != TXN_OK)
|
||||
goto err;
|
||||
/* else ret = 0; Not necessary because TXN_OK == 0 */
|
||||
} else {
|
||||
/* This is a normal commit; mark it appropriately. */
|
||||
ret = __db_txnlist_update(dbenv,
|
||||
info, argp->txnid->txnid, argp->opcode, lsnp);
|
||||
|
||||
if (ret == TXN_NOTFOUND)
|
||||
ret = __db_txnlist_add(dbenv,
|
||||
info, argp->txnid->txnid,
|
||||
argp->opcode == TXN_ABORT ?
|
||||
TXN_IGNORE : argp->opcode, lsnp);
|
||||
else if (ret != TXN_OK)
|
||||
goto err;
|
||||
/* else ret = 0; Not necessary because TXN_OK == 0 */
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
*lsnp = argp->prev_lsn;
|
||||
err: __os_free(argp, 0);
|
||||
|
||||
if (0) {
|
||||
err: __db_err(dbenv,
|
||||
"txnid %lx commit record found, already on commit list",
|
||||
argp->txnid->txnid);
|
||||
ret = EINVAL;
|
||||
}
|
||||
__os_free(dbenv, argp);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -140,58 +169,50 @@ __txn_xa_regop_recover(dbenv, dbtp, lsnp, op, info)
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = __db_txnlist_find(info, argp->txnid->txnid);
|
||||
ret = __db_txnlist_find(dbenv, info, argp->txnid->txnid);
|
||||
|
||||
/*
|
||||
* If we are rolling forward, then an aborted prepare
|
||||
* indicates that this is the last record we'll see for
|
||||
* this transaction ID and we should remove it from the
|
||||
* indicates that this may the last record we'll see for
|
||||
* this transaction ID, so we should remove it from the
|
||||
* list.
|
||||
*/
|
||||
|
||||
if (op == DB_TXN_FORWARD_ROLL && ret == 1)
|
||||
ret = __db_txnlist_remove(info, argp->txnid->txnid);
|
||||
else if (op == DB_TXN_BACKWARD_ROLL && ret != 0) {
|
||||
if (op == DB_TXN_FORWARD_ROLL) {
|
||||
if ((ret = __db_txnlist_remove(dbenv,
|
||||
info, argp->txnid->txnid)) != TXN_OK)
|
||||
goto txn_err;
|
||||
} else if (op == DB_TXN_BACKWARD_ROLL && ret == TXN_PREPARE) {
|
||||
/*
|
||||
* On the backward pass, we have three possibilities:
|
||||
* 1. The transaction is already committed, no-op.
|
||||
* 2. The transaction is not committed and we are XA, treat
|
||||
* like commited and roll forward so that can be committed
|
||||
* or aborted late.
|
||||
* 3. The transaction is not committed and we are not XA
|
||||
* mark the transaction as aborted.
|
||||
*
|
||||
* Cases 2 and 3 are handled here.
|
||||
* 2. The transaction is already aborted, no-op.
|
||||
* 3. The transaction is neither committed nor aborted.
|
||||
* Treat this like a commit and roll forward so that
|
||||
* the transaction can be resurrected in the region.
|
||||
* We handle case 3 here; cases 1 and 2 are the final clause
|
||||
* below.
|
||||
* This is prepared, but not yet committed transaction. We
|
||||
* need to add it to the transaction list, so that it gets
|
||||
* rolled forward. We also have to add it to the region's
|
||||
* internal state so it can be properly aborted or committed
|
||||
* after recovery (see txn_recover).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Should never have seen this transaction unless it was
|
||||
* commited.
|
||||
*/
|
||||
DB_ASSERT(ret == DB_NOTFOUND);
|
||||
|
||||
if (IS_XA_TXN(argp)) {
|
||||
/*
|
||||
* This is an XA prepared, but not yet committed
|
||||
* transaction. We need to add it to the
|
||||
* transaction list, so that it gets rolled
|
||||
* forward. We also have to add it to the region's
|
||||
* internal state so it can be properly aborted
|
||||
* or recovered.
|
||||
*/
|
||||
if ((ret = __db_txnlist_add(dbenv,
|
||||
info, argp->txnid->txnid, 0)) == 0)
|
||||
ret = __txn_restore_txn(dbenv, lsnp, argp);
|
||||
} else
|
||||
ret = __db_txnlist_add(dbenv,
|
||||
info, argp->txnid->txnid, 1);
|
||||
if ((ret = __db_txnlist_remove(dbenv,
|
||||
info, argp->txnid->txnid)) != TXN_OK) {
|
||||
txn_err: __db_err(dbenv,
|
||||
"Transaction not in list %x", argp->txnid->txnid);
|
||||
ret = DB_NOTFOUND;
|
||||
} else if ((ret = __db_txnlist_add(dbenv,
|
||||
info, argp->txnid->txnid, TXN_COMMIT, lsnp)) == 0)
|
||||
ret = __txn_restore_txn(dbenv, lsnp, argp);
|
||||
} else
|
||||
ret = 0;
|
||||
|
||||
if (ret == 0)
|
||||
*lsnp = argp->prev_lsn;
|
||||
|
||||
err: __os_free(argp, 0);
|
||||
err: __os_free(dbenv, argp);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -219,18 +240,11 @@ __txn_ckp_recover(dbenv, dbtp, lsnp, op, info)
|
|||
if ((ret = __txn_ckp_read(dbenv, dbtp->data, &argp)) != 0)
|
||||
return (ret);
|
||||
|
||||
/*
|
||||
* Check for 'restart' checkpoint record. This occurs when the
|
||||
* checkpoint lsn is equal to the lsn of the checkpoint record
|
||||
* and means that we could set the transaction ID back to 1, so
|
||||
* that we don't exhaust the transaction ID name space.
|
||||
*/
|
||||
if (argp->ckp_lsn.file == lsnp->file &&
|
||||
argp->ckp_lsn.offset == lsnp->offset)
|
||||
__db_txnlist_gen(info, DB_REDO(op) ? -1 : 1);
|
||||
if (op == DB_TXN_BACKWARD_ROLL)
|
||||
__db_txnlist_ckp(dbenv, info, lsnp);
|
||||
|
||||
*lsnp = argp->last_ckp;
|
||||
__os_free(argp, 0);
|
||||
__os_free(dbenv, argp);
|
||||
return (DB_TXN_CKP);
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +264,7 @@ __txn_child_recover(dbenv, dbtp, lsnp, op, info)
|
|||
void *info;
|
||||
{
|
||||
__txn_child_args *argp;
|
||||
int ret;
|
||||
int c_stat, p_stat, ret;
|
||||
|
||||
#ifdef DEBUG_RECOVER
|
||||
(void)__txn_child_print(dbenv, dbtp, lsnp, op, info);
|
||||
|
|
@ -272,17 +286,54 @@ __txn_child_recover(dbenv, dbtp, lsnp, op, info)
|
|||
ret = __db_txnlist_lsnadd(dbenv,
|
||||
info, &argp->c_lsn, TXNLIST_NEW);
|
||||
} else if (op == DB_TXN_BACKWARD_ROLL) {
|
||||
if (__db_txnlist_find(info, argp->txnid->txnid) == 0)
|
||||
ret = __db_txnlist_add(dbenv, info, argp->child, 0);
|
||||
else
|
||||
ret = __db_txnlist_add(dbenv, info, argp->child, 1);
|
||||
} else
|
||||
ret = __db_txnlist_remove(info, argp->child);
|
||||
/* Child might exist -- look for it. */
|
||||
c_stat = __db_txnlist_find(dbenv, info, argp->child);
|
||||
p_stat = __db_txnlist_find(dbenv, info, argp->txnid->txnid);
|
||||
|
||||
if (c_stat == TXN_EXPECTED) {
|
||||
/*
|
||||
* The open after this create succeeded. If the
|
||||
* parent succeeded, we don't want to redo; if the
|
||||
* parent aborted, we do want to undo.
|
||||
*/
|
||||
ret = __db_txnlist_update(dbenv,
|
||||
info, argp->child,
|
||||
p_stat == TXN_COMMIT ? TXN_IGNORE : TXN_ABORT,
|
||||
NULL);
|
||||
if (ret > 0)
|
||||
ret = 0;
|
||||
} else if (c_stat == TXN_UNEXPECTED) {
|
||||
/*
|
||||
* The open after this create failed. If the parent
|
||||
* is rolling forward, we need to roll forward. If
|
||||
* the parent failed, then we do not want to abort
|
||||
* (because the file may not be the one in which we
|
||||
* are interested).
|
||||
*/
|
||||
ret = __db_txnlist_update(dbenv, info, argp->child,
|
||||
p_stat == TXN_COMMIT ? TXN_COMMIT : TXN_IGNORE,
|
||||
NULL);
|
||||
if (ret > 0)
|
||||
ret = 0;
|
||||
} else if (c_stat != TXN_IGNORE) {
|
||||
ret = __db_txnlist_add(dbenv, info, argp->child,
|
||||
p_stat == TXN_COMMIT ? TXN_COMMIT : TXN_ABORT,
|
||||
NULL);
|
||||
}
|
||||
} else {
|
||||
/* Forward Roll */
|
||||
if ((ret =
|
||||
__db_txnlist_remove(dbenv, info, argp->child)) != TXN_OK) {
|
||||
__db_err(dbenv,
|
||||
"Transaction not in list %x", argp->txnid->txnid);
|
||||
ret = DB_NOTFOUND;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
*lsnp = argp->prev_lsn;
|
||||
|
||||
__os_free(argp, 0);
|
||||
__os_free(dbenv, argp);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -291,13 +342,16 @@ __txn_child_recover(dbenv, dbtp, lsnp, op, info)
|
|||
* __txn_restore_txn --
|
||||
* Using only during XA recovery. If we find any transactions that are
|
||||
* prepared, but not yet committed, then we need to restore the transaction's
|
||||
* state into the shared region, because the TM is going to issue a txn_abort
|
||||
* or txn_commit and we need to respond correctly.
|
||||
* state into the shared region, because the TM is going to issue an abort
|
||||
* or commit and we need to respond correctly.
|
||||
*
|
||||
* lsnp is the LSN of the returned LSN
|
||||
* argp is the perpare record (in an appropriate structure)
|
||||
*
|
||||
* PUBLIC: int __txn_restore_txn __P((DB_ENV *,
|
||||
* PUBLIC: DB_LSN *, __txn_xa_regop_args *));
|
||||
*/
|
||||
static int
|
||||
int
|
||||
__txn_restore_txn(dbenv, lsnp, argp)
|
||||
DB_ENV *dbenv;
|
||||
DB_LSN *lsnp;
|
||||
|
|
@ -317,8 +371,10 @@ __txn_restore_txn(dbenv, lsnp, argp)
|
|||
|
||||
/* Allocate a new transaction detail structure. */
|
||||
if ((ret =
|
||||
__db_shalloc(mgr->reginfo.addr, sizeof(TXN_DETAIL), 0, &td)) != 0)
|
||||
__db_shalloc(mgr->reginfo.addr, sizeof(TXN_DETAIL), 0, &td)) != 0) {
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* Place transaction on active transaction list. */
|
||||
SH_TAILQ_INSERT_HEAD(®ion->active_txn, td, links, __txn_detail);
|
||||
|
|
@ -333,7 +389,48 @@ __txn_restore_txn(dbenv, lsnp, argp)
|
|||
td->bqual = argp->bqual;
|
||||
td->gtrid = argp->gtrid;
|
||||
td->format = argp->formatID;
|
||||
td->flags = 0;
|
||||
F_SET(td, TXN_RESTORED);
|
||||
|
||||
region->stat.st_nrestores++;
|
||||
region->stat.st_nactive++;
|
||||
if (region->stat.st_nactive > region->stat.st_maxnactive)
|
||||
region->stat.st_maxnactive = region->stat.st_nactive;
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_recycle_recover --
|
||||
* Recovery function for recycle.
|
||||
*
|
||||
* PUBLIC: int __txn_recycle_recover
|
||||
* PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
|
||||
*/
|
||||
int
|
||||
__txn_recycle_recover(dbenv, dbtp, lsnp, op, info)
|
||||
DB_ENV *dbenv;
|
||||
DBT *dbtp;
|
||||
DB_LSN *lsnp;
|
||||
db_recops op;
|
||||
void *info;
|
||||
{
|
||||
__txn_recycle_args *argp;
|
||||
int ret;
|
||||
|
||||
#ifdef DEBUG_RECOVER
|
||||
(void)__txn_child_print(dbenv, dbtp, lsnp, op, info);
|
||||
#endif
|
||||
if ((ret = __txn_recycle_read(dbenv, dbtp->data, &argp)) != 0)
|
||||
return (ret);
|
||||
|
||||
COMPQUIET(lsnp, NULL);
|
||||
|
||||
if ((ret = __db_txnlist_gen(dbenv, info,
|
||||
DB_UNDO(op) ? -1 : 1, argp->min, argp->max)) != 0)
|
||||
return (ret);
|
||||
|
||||
__os_free(dbenv, argp);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
306
bdb/txn/txn_recover.c
Normal file
306
bdb/txn/txn_recover.c
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 2001-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: txn_recover.c,v 1.36 2002/08/19 16:59:15 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef NO_SYSTEM_INCLUDES
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "dbinc/txn.h"
|
||||
#include "dbinc/db_page.h"
|
||||
#include "dbinc/log.h"
|
||||
#include "dbinc_auto/db_auto.h"
|
||||
#include "dbinc_auto/crdel_auto.h"
|
||||
#include "dbinc_auto/db_ext.h"
|
||||
|
||||
/*
|
||||
* __txn_continue
|
||||
* Fill in the fields of the local transaction structure given
|
||||
* the detail transaction structure.
|
||||
*
|
||||
* XXX
|
||||
* I'm not sure that we work correctly with nested txns.
|
||||
*
|
||||
* PUBLIC: void __txn_continue __P((DB_ENV *, DB_TXN *, TXN_DETAIL *, size_t));
|
||||
*/
|
||||
void
|
||||
__txn_continue(env, txnp, td, off)
|
||||
DB_ENV *env;
|
||||
DB_TXN *txnp;
|
||||
TXN_DETAIL *td;
|
||||
size_t off;
|
||||
{
|
||||
txnp->mgrp = env->tx_handle;
|
||||
txnp->parent = NULL;
|
||||
txnp->last_lsn = td->last_lsn;
|
||||
txnp->txnid = td->txnid;
|
||||
txnp->off = (roff_t)off;
|
||||
|
||||
txnp->abort = __txn_abort;
|
||||
txnp->commit = __txn_commit;
|
||||
txnp->discard = __txn_discard;
|
||||
txnp->id = __txn_id;
|
||||
txnp->prepare = __txn_prepare;
|
||||
|
||||
txnp->flags = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_map_gid
|
||||
* Return the txn that corresponds to this global ID.
|
||||
*
|
||||
* PUBLIC: int __txn_map_gid __P((DB_ENV *,
|
||||
* PUBLIC: u_int8_t *, TXN_DETAIL **, size_t *));
|
||||
*/
|
||||
int
|
||||
__txn_map_gid(dbenv, gid, tdp, offp)
|
||||
DB_ENV *dbenv;
|
||||
u_int8_t *gid;
|
||||
TXN_DETAIL **tdp;
|
||||
size_t *offp;
|
||||
{
|
||||
DB_TXNMGR *mgr;
|
||||
DB_TXNREGION *tmr;
|
||||
|
||||
mgr = dbenv->tx_handle;
|
||||
tmr = mgr->reginfo.primary;
|
||||
|
||||
/*
|
||||
* Search the internal active transaction table to find the
|
||||
* matching xid. If this is a performance hit, then we
|
||||
* can create a hash table, but I doubt it's worth it.
|
||||
*/
|
||||
R_LOCK(dbenv, &mgr->reginfo);
|
||||
for (*tdp = SH_TAILQ_FIRST(&tmr->active_txn, __txn_detail);
|
||||
*tdp != NULL;
|
||||
*tdp = SH_TAILQ_NEXT(*tdp, links, __txn_detail))
|
||||
if (memcmp(gid, (*tdp)->xid, sizeof((*tdp)->xid)) == 0)
|
||||
break;
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
|
||||
if (*tdp == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
*offp = R_OFFSET(&mgr->reginfo, *tdp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_recover --
|
||||
* Public interface to retrieve the list of prepared, but not yet
|
||||
* commited transactions. See __txn_get_prepared for details. This
|
||||
* function and __db_xa_recover both wrap that one.
|
||||
*
|
||||
* PUBLIC: int __txn_recover
|
||||
* PUBLIC: __P((DB_ENV *, DB_PREPLIST *, long, long *, u_int32_t));
|
||||
*/
|
||||
int
|
||||
__txn_recover(dbenv, preplist, count, retp, flags)
|
||||
DB_ENV *dbenv;
|
||||
DB_PREPLIST *preplist;
|
||||
long count, *retp;
|
||||
u_int32_t flags;
|
||||
{
|
||||
PANIC_CHECK(dbenv);
|
||||
ENV_REQUIRES_CONFIG(
|
||||
dbenv, dbenv->tx_handle, "txn_recover", DB_INIT_TXN);
|
||||
|
||||
if (F_ISSET((DB_TXNREGION *)
|
||||
((DB_TXNMGR *)dbenv->tx_handle)->reginfo.primary,
|
||||
TXN_IN_RECOVERY)) {
|
||||
__db_err(dbenv, "operation not permitted while in recovery");
|
||||
return (EINVAL);
|
||||
}
|
||||
return (__txn_get_prepared(dbenv, NULL, preplist, count, retp, flags));
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_get_prepared --
|
||||
* Returns a list of prepared (and for XA, heuristically completed)
|
||||
* transactions (less than or equal to the count parameter). One of
|
||||
* xids or txns must be set to point to an array of the appropriate type.
|
||||
* The count parameter indicates the number of entries in the xids and/or
|
||||
* txns array. The retp parameter will be set to indicate the number of
|
||||
* entries returned in the xids/txns array. Flags indicates the operation,
|
||||
* one of DB_FIRST or DB_NEXT.
|
||||
*
|
||||
* PUBLIC: int __txn_get_prepared __P((DB_ENV *,
|
||||
* PUBLIC: XID *, DB_PREPLIST *, long, long *, u_int32_t));
|
||||
*/
|
||||
int
|
||||
__txn_get_prepared(dbenv, xids, txns, count, retp, flags)
|
||||
DB_ENV *dbenv;
|
||||
XID *xids;
|
||||
DB_PREPLIST *txns;
|
||||
long count; /* This is long for XA compatibility. */
|
||||
long *retp;
|
||||
u_int32_t flags;
|
||||
{
|
||||
DBT data;
|
||||
DB_LOGC *logc;
|
||||
DB_LSN min, open_lsn;
|
||||
DB_PREPLIST *prepp;
|
||||
DB_TXNMGR *mgr;
|
||||
DB_TXNREGION *tmr;
|
||||
TXN_DETAIL *td;
|
||||
XID *xidp;
|
||||
__txn_ckp_args *ckp_args;
|
||||
long i;
|
||||
int nrestores, open_files, ret, t_ret;
|
||||
void *txninfo;
|
||||
|
||||
*retp = 0;
|
||||
|
||||
logc = NULL;
|
||||
MAX_LSN(min);
|
||||
prepp = txns;
|
||||
xidp = xids;
|
||||
nrestores = ret = 0;
|
||||
open_files = 1;
|
||||
|
||||
/*
|
||||
* If we are starting a scan, then we traverse the active transaction
|
||||
* list once making sure that all transactions are marked as not having
|
||||
* been collected. Then on each pass, we mark the ones we collected
|
||||
* so that if we cannot collect them all at once, we can finish up
|
||||
* next time with a continue.
|
||||
*/
|
||||
|
||||
mgr = dbenv->tx_handle;
|
||||
tmr = mgr->reginfo.primary;
|
||||
|
||||
/*
|
||||
* During this pass we need to figure out if we are going to need
|
||||
* to open files. We need to open files if we've never collected
|
||||
* before (in which case, none of the COLLECTED bits will be set)
|
||||
* and the ones that we are collecting are restored (if they aren't
|
||||
* restored, then we never crashed; just the main server did).
|
||||
*/
|
||||
R_LOCK(dbenv, &mgr->reginfo);
|
||||
if (flags == DB_FIRST) {
|
||||
for (td = SH_TAILQ_FIRST(&tmr->active_txn, __txn_detail);
|
||||
td != NULL;
|
||||
td = SH_TAILQ_NEXT(td, links, __txn_detail)) {
|
||||
if (F_ISSET(td, TXN_RESTORED))
|
||||
nrestores++;
|
||||
if (F_ISSET(td, TXN_COLLECTED))
|
||||
open_files = 0;
|
||||
F_CLR(td, TXN_COLLECTED);
|
||||
}
|
||||
mgr->n_discards = 0;
|
||||
} else
|
||||
open_files = 0;
|
||||
|
||||
/* Now begin collecting active transactions. */
|
||||
for (td = SH_TAILQ_FIRST(&tmr->active_txn, __txn_detail);
|
||||
td != NULL && *retp < count;
|
||||
td = SH_TAILQ_NEXT(td, links, __txn_detail)) {
|
||||
if (td->status != TXN_PREPARED || F_ISSET(td, TXN_COLLECTED))
|
||||
continue;
|
||||
|
||||
if (xids != NULL) {
|
||||
xidp->formatID = td->format;
|
||||
xidp->gtrid_length = td->gtrid;
|
||||
xidp->bqual_length = td->bqual;
|
||||
memcpy(xidp->data, td->xid, sizeof(td->xid));
|
||||
xidp++;
|
||||
}
|
||||
|
||||
if (txns != NULL) {
|
||||
if ((ret = __os_calloc(dbenv,
|
||||
1, sizeof(DB_TXN), &prepp->txn)) != 0)
|
||||
goto err;
|
||||
__txn_continue(dbenv,
|
||||
prepp->txn, td, R_OFFSET(&mgr->reginfo, td));
|
||||
F_SET(prepp->txn, TXN_MALLOC);
|
||||
memcpy(prepp->gid, td->xid, sizeof(td->xid));
|
||||
prepp++;
|
||||
}
|
||||
|
||||
if (log_compare(&td->begin_lsn, &min) < 0)
|
||||
min = td->begin_lsn;
|
||||
|
||||
(*retp)++;
|
||||
F_SET(td, TXN_COLLECTED);
|
||||
}
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
|
||||
/*
|
||||
* Now link all the transactions into the transaction manager's list.
|
||||
*/
|
||||
if (txns != NULL) {
|
||||
MUTEX_THREAD_LOCK(dbenv, mgr->mutexp);
|
||||
for (i = 0; i < *retp; i++)
|
||||
TAILQ_INSERT_TAIL(&mgr->txn_chain, txns[i].txn, links);
|
||||
MUTEX_THREAD_UNLOCK(dbenv, mgr->mutexp);
|
||||
}
|
||||
|
||||
if (open_files && nrestores && *retp != 0 && !IS_MAX_LSN(min)) {
|
||||
/*
|
||||
* Figure out the last checkpoint before the smallest
|
||||
* start_lsn in the region.
|
||||
*/
|
||||
F_SET((DB_LOG *)dbenv->lg_handle, DBLOG_RECOVER);
|
||||
|
||||
if ((ret = dbenv->log_cursor(dbenv, &logc, 0)) != 0)
|
||||
goto err;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
if ((ret = __txn_getckp(dbenv, &open_lsn)) == 0)
|
||||
while (!IS_ZERO_LSN(open_lsn) && (ret =
|
||||
logc->get(logc, &open_lsn, &data, DB_SET)) == 0 &&
|
||||
log_compare(&min, &open_lsn) < 0) {
|
||||
/* Format the log record. */
|
||||
if ((ret = __txn_ckp_read(dbenv,
|
||||
data.data, &ckp_args)) != 0) {
|
||||
__db_err(dbenv,
|
||||
"Invalid checkpoint record at [%lu][%lu]",
|
||||
(u_long)open_lsn.file,
|
||||
(u_long)open_lsn.offset);
|
||||
goto err;
|
||||
}
|
||||
open_lsn = ckp_args->last_ckp;
|
||||
__os_free(dbenv, ckp_args);
|
||||
}
|
||||
|
||||
/*
|
||||
* There are three ways by which we may have gotten here.
|
||||
* - We got a DB_NOTFOUND -- we need to read the first
|
||||
* log record.
|
||||
* - We found a checkpoint before min. We're done.
|
||||
* - We found a checkpoint after min who's last_ckp is 0. We
|
||||
* need to start at the beginning of the log.
|
||||
*/
|
||||
if ((ret == DB_NOTFOUND || IS_ZERO_LSN(open_lsn)) &&
|
||||
(ret = logc->get(logc, &open_lsn, &data, DB_FIRST)) != 0) {
|
||||
__db_err(dbenv, "No log records");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((ret = __db_txnlist_init(dbenv, 0, 0, NULL, &txninfo)) != 0)
|
||||
goto err;
|
||||
ret = __env_openfiles(dbenv, logc,
|
||||
txninfo, &data, &open_lsn, NULL, 0, 0);
|
||||
if (txninfo != NULL)
|
||||
__db_txnlist_end(dbenv, txninfo);
|
||||
}
|
||||
|
||||
err: F_CLR((DB_LOG *)dbenv->lg_handle, DBLOG_RECOVER);
|
||||
|
||||
if (logc != NULL && (t_ret = logc->close(logc, 0)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1996-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: txn_region.c,v 11.36 2001/01/11 18:19:55 bostic Exp $";
|
||||
static const char revid[] = "$Id: txn_region.c,v 11.73 2002/08/06 04:42:37 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef NO_SYSTEM_INCLUDES
|
||||
|
|
@ -28,98 +28,13 @@ static const char revid[] = "$Id: txn_region.c,v 11.36 2001/01/11 18:19:55 bosti
|
|||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
#include "db_server.h"
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "db_page.h"
|
||||
#include "log.h" /* for __log_lastckp */
|
||||
#include "txn.h"
|
||||
#include "db_am.h"
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
#include "gen_client_ext.h"
|
||||
#include "rpc_client_ext.h"
|
||||
#endif
|
||||
#include "dbinc/log.h"
|
||||
#include "dbinc/txn.h"
|
||||
|
||||
static int __txn_findlastckp __P((DB_ENV *, DB_LSN *));
|
||||
static int __txn_init __P((DB_ENV *, DB_TXNMGR *));
|
||||
static int __txn_set_tx_max __P((DB_ENV *, u_int32_t));
|
||||
static int __txn_set_tx_recover __P((DB_ENV *,
|
||||
int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops)));
|
||||
static int __txn_set_tx_timestamp __P((DB_ENV *, time_t *));
|
||||
|
||||
/*
|
||||
* __txn_dbenv_create --
|
||||
* Transaction specific initialization of the DB_ENV structure.
|
||||
*
|
||||
* PUBLIC: void __txn_dbenv_create __P((DB_ENV *));
|
||||
*/
|
||||
void
|
||||
__txn_dbenv_create(dbenv)
|
||||
DB_ENV *dbenv;
|
||||
{
|
||||
dbenv->tx_max = DEF_MAX_TXNS;
|
||||
|
||||
dbenv->set_tx_max = __txn_set_tx_max;
|
||||
dbenv->set_tx_recover = __txn_set_tx_recover;
|
||||
dbenv->set_tx_timestamp = __txn_set_tx_timestamp;
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
/*
|
||||
* If we have a client, overwrite what we just setup to point to
|
||||
* client functions.
|
||||
*/
|
||||
if (F_ISSET(dbenv, DB_ENV_RPCCLIENT)) {
|
||||
dbenv->set_tx_max = __dbcl_set_tx_max;
|
||||
dbenv->set_tx_recover = __dbcl_set_tx_recover;
|
||||
dbenv->set_tx_timestamp = __dbcl_set_tx_timestamp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_set_tx_max --
|
||||
* Set the size of the transaction table.
|
||||
*/
|
||||
static int
|
||||
__txn_set_tx_max(dbenv, tx_max)
|
||||
DB_ENV *dbenv;
|
||||
u_int32_t tx_max;
|
||||
{
|
||||
ENV_ILLEGAL_AFTER_OPEN(dbenv, "set_tx_max");
|
||||
|
||||
dbenv->tx_max = tx_max;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_set_tx_recover --
|
||||
* Set the transaction abort recover function.
|
||||
*/
|
||||
static int
|
||||
__txn_set_tx_recover(dbenv, tx_recover)
|
||||
DB_ENV *dbenv;
|
||||
int (*tx_recover) __P((DB_ENV *, DBT *, DB_LSN *, db_recops));
|
||||
{
|
||||
dbenv->tx_recover = tx_recover;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_set_tx_timestamp --
|
||||
* Set the transaction recovery timestamp.
|
||||
*/
|
||||
static int
|
||||
__txn_set_tx_timestamp(dbenv, timestamp)
|
||||
DB_ENV *dbenv;
|
||||
time_t *timestamp;
|
||||
{
|
||||
ENV_ILLEGAL_AFTER_OPEN(dbenv, "set_tx_timestamp");
|
||||
|
||||
dbenv->tx_timestamp = *timestamp;
|
||||
return (0);
|
||||
}
|
||||
static size_t __txn_region_size __P((DB_ENV *));
|
||||
|
||||
/*
|
||||
* __txn_open --
|
||||
|
|
@ -148,7 +63,7 @@ __txn_open(dbenv)
|
|||
if (F_ISSET(dbenv, DB_ENV_CREATE))
|
||||
F_SET(&tmgrp->reginfo, REGION_CREATE_OK);
|
||||
if ((ret = __db_r_attach(dbenv,
|
||||
&tmgrp->reginfo, TXN_REGION_SIZE(dbenv->tx_max))) != 0)
|
||||
&tmgrp->reginfo, __txn_region_size(dbenv))) != 0)
|
||||
goto err;
|
||||
|
||||
/* If we created the region, initialize it. */
|
||||
|
|
@ -161,14 +76,10 @@ __txn_open(dbenv)
|
|||
R_ADDR(&tmgrp->reginfo, tmgrp->reginfo.rp->primary);
|
||||
|
||||
/* Acquire a mutex to protect the active TXN list. */
|
||||
if (F_ISSET(dbenv, DB_ENV_THREAD)) {
|
||||
if ((ret = __db_mutex_alloc(
|
||||
dbenv, &tmgrp->reginfo, &tmgrp->mutexp)) != 0)
|
||||
goto err;
|
||||
if ((ret = __db_mutex_init(
|
||||
dbenv, tmgrp->mutexp, 0, MUTEX_THREAD)) != 0)
|
||||
goto err;
|
||||
}
|
||||
if (F_ISSET(dbenv, DB_ENV_THREAD) &&
|
||||
(ret = __db_mutex_setup(dbenv, &tmgrp->reginfo, &tmgrp->mutexp,
|
||||
MUTEX_ALLOC | MUTEX_NO_RLOCK | MUTEX_THREAD)) != 0)
|
||||
goto err;
|
||||
|
||||
R_UNLOCK(dbenv, &tmgrp->reginfo);
|
||||
|
||||
|
|
@ -184,7 +95,7 @@ err: if (tmgrp->reginfo.addr != NULL) {
|
|||
}
|
||||
if (tmgrp->mutexp != NULL)
|
||||
__db_mutex_free(dbenv, &tmgrp->reginfo, tmgrp->mutexp);
|
||||
__os_free(tmgrp, sizeof(*tmgrp));
|
||||
__os_free(dbenv, tmgrp);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
|
@ -200,15 +111,29 @@ __txn_init(dbenv, tmgrp)
|
|||
DB_LSN last_ckp;
|
||||
DB_TXNREGION *region;
|
||||
int ret;
|
||||
#ifdef HAVE_MUTEX_SYSTEM_RESOURCES
|
||||
u_int8_t *addr;
|
||||
#endif
|
||||
|
||||
ZERO_LSN(last_ckp);
|
||||
/*
|
||||
* If possible, fetch the last checkpoint LSN from the log system
|
||||
* so that the backwards chain of checkpoints is unbroken when
|
||||
* the environment is removed and recreated. [#2865]
|
||||
* Find the last checkpoint in the log.
|
||||
*/
|
||||
if (LOGGING_ON(dbenv) && (ret = __log_lastckp(dbenv, &last_ckp)) != 0)
|
||||
return (ret);
|
||||
ZERO_LSN(last_ckp);
|
||||
if (LOGGING_ON(dbenv)) {
|
||||
/*
|
||||
* The log system has already walked through the last
|
||||
* file. Get the LSN of a checkpoint it may have found.
|
||||
*/
|
||||
__log_get_cached_ckp_lsn(dbenv, &last_ckp);
|
||||
|
||||
/*
|
||||
* If that didn't work, look backwards from the beginning of
|
||||
* the last log file until we find the last checkpoint.
|
||||
*/
|
||||
if (IS_ZERO_LSN(last_ckp) &&
|
||||
(ret = __txn_findlastckp(dbenv, &last_ckp)) != 0)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if ((ret = __db_shalloc(tmgrp->reginfo.addr,
|
||||
sizeof(DB_TXNREGION), 0, &tmgrp->reginfo.primary)) != 0) {
|
||||
|
|
@ -223,7 +148,7 @@ __txn_init(dbenv, tmgrp)
|
|||
|
||||
region->maxtxns = dbenv->tx_max;
|
||||
region->last_txnid = TXN_MINIMUM;
|
||||
ZERO_LSN(region->pending_ckp);
|
||||
region->cur_maxid = TXN_MAXIMUM;
|
||||
region->last_ckp = last_ckp;
|
||||
region->time_ckp = time(NULL);
|
||||
|
||||
|
|
@ -233,25 +158,86 @@ __txn_init(dbenv, tmgrp)
|
|||
*/
|
||||
region->logtype = 0;
|
||||
region->locktype = 0;
|
||||
region->naborts = 0;
|
||||
region->ncommits = 0;
|
||||
region->nbegins = 0;
|
||||
region->nactive = 0;
|
||||
region->maxnactive = 0;
|
||||
|
||||
memset(®ion->stat, 0, sizeof(region->stat));
|
||||
region->stat.st_maxtxns = region->maxtxns;
|
||||
|
||||
SH_TAILQ_INIT(®ion->active_txn);
|
||||
|
||||
#ifdef HAVE_MUTEX_SYSTEM_RESOURCES
|
||||
/* Allocate room for the txn maintenance info and initialize it. */
|
||||
if ((ret = __db_shalloc(tmgrp->reginfo.addr,
|
||||
sizeof(REGMAINT) + TXN_MAINT_SIZE, 0, &addr)) != 0) {
|
||||
__db_err(dbenv,
|
||||
"Unable to allocate memory for mutex maintenance");
|
||||
return (ret);
|
||||
}
|
||||
__db_maintinit(&tmgrp->reginfo, addr, TXN_MAINT_SIZE);
|
||||
region->maint_off = R_OFFSET(&tmgrp->reginfo, addr);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_close --
|
||||
* Close a transaction region.
|
||||
* __txn_findlastckp --
|
||||
* Find the last checkpoint in the log, walking backwards from the
|
||||
* beginning of the last log file. (The log system looked through
|
||||
* the last log file when it started up.)
|
||||
*/
|
||||
static int
|
||||
__txn_findlastckp(dbenv, lsnp)
|
||||
DB_ENV *dbenv;
|
||||
DB_LSN *lsnp;
|
||||
{
|
||||
DB_LOGC *logc;
|
||||
DB_LSN lsn;
|
||||
DBT dbt;
|
||||
int ret, t_ret;
|
||||
u_int32_t rectype;
|
||||
|
||||
if ((ret = dbenv->log_cursor(dbenv, &logc, 0)) != 0)
|
||||
return (ret);
|
||||
|
||||
/* Get the last LSN. */
|
||||
memset(&dbt, 0, sizeof(dbt));
|
||||
if ((ret = logc->get(logc, &lsn, &dbt, DB_LAST)) != 0)
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Twiddle the last LSN so it points to the beginning of the last
|
||||
* file; we know there's no checkpoint after that, since the log
|
||||
* system already looked there.
|
||||
*/
|
||||
lsn.offset = 0;
|
||||
|
||||
/* Read backwards, looking for checkpoints. */
|
||||
while ((ret = logc->get(logc, &lsn, &dbt, DB_PREV)) == 0) {
|
||||
if (dbt.size < sizeof(u_int32_t))
|
||||
continue;
|
||||
memcpy(&rectype, dbt.data, sizeof(u_int32_t));
|
||||
if (rectype == DB___txn_ckp) {
|
||||
*lsnp = lsn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
err: if ((t_ret = logc->close(logc, 0)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
/*
|
||||
* Not finding a checkpoint is not an error; there may not exist
|
||||
* one in the log.
|
||||
*/
|
||||
return ((ret == 0 || ret == DB_NOTFOUND) ? 0 : ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_dbenv_refresh --
|
||||
* Clean up after the transaction system on a close or failed open.
|
||||
* Called only from __dbenv_refresh. (Formerly called __txn_close.)
|
||||
*
|
||||
* PUBLIC: int __txn_close __P((DB_ENV *));
|
||||
* PUBLIC: int __txn_dbenv_refresh __P((DB_ENV *));
|
||||
*/
|
||||
int
|
||||
__txn_close(dbenv)
|
||||
__txn_dbenv_refresh(dbenv)
|
||||
DB_ENV *dbenv;
|
||||
{
|
||||
DB_TXN *txnp;
|
||||
|
|
@ -274,22 +260,23 @@ __txn_close(dbenv)
|
|||
*/
|
||||
if (TAILQ_FIRST(&tmgrp->txn_chain) != NULL) {
|
||||
__db_err(dbenv,
|
||||
"Error: closing the transaction region with active transactions\n");
|
||||
"Error: closing the transaction region with active transactions");
|
||||
ret = EINVAL;
|
||||
while ((txnp = TAILQ_FIRST(&tmgrp->txn_chain)) != NULL) {
|
||||
txnid = txnp->txnid;
|
||||
if ((t_ret = txn_abort(txnp)) != 0) {
|
||||
if ((t_ret = txnp->abort(txnp)) != 0) {
|
||||
__db_err(dbenv,
|
||||
"Unable to abort transaction 0x%x: %s\n",
|
||||
"Unable to abort transaction 0x%x: %s",
|
||||
txnid, db_strerror(t_ret));
|
||||
ret = __db_panic(dbenv, t_ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Flush the log. */
|
||||
if (LOGGING_ON(dbenv) &&
|
||||
(t_ret = log_flush(dbenv, NULL)) != 0 && ret == 0)
|
||||
(t_ret = dbenv->log_flush(dbenv, NULL)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
|
||||
/* Discard the per-thread lock. */
|
||||
|
|
@ -300,94 +287,88 @@ __txn_close(dbenv)
|
|||
if ((t_ret = __db_r_detach(dbenv, &tmgrp->reginfo, 0)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
|
||||
__os_free(tmgrp, sizeof(*tmgrp));
|
||||
__os_free(dbenv, tmgrp);
|
||||
|
||||
dbenv->tx_handle = NULL;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
txn_stat(dbenv, statp, db_malloc)
|
||||
/*
|
||||
* __txn_region_size --
|
||||
* Return the amount of space needed for the txn region. Make the
|
||||
* region large enough to hold txn_max transaction detail structures
|
||||
* plus some space to hold thread handles and the beginning of the
|
||||
* shalloc region and anything we need for mutex system resource
|
||||
* recording.
|
||||
*/
|
||||
static size_t
|
||||
__txn_region_size(dbenv)
|
||||
DB_ENV *dbenv;
|
||||
DB_TXN_STAT **statp;
|
||||
void *(*db_malloc) __P((size_t));
|
||||
{
|
||||
size_t s;
|
||||
|
||||
s = sizeof(DB_TXNREGION) +
|
||||
dbenv->tx_max * sizeof(TXN_DETAIL) + 10 * 1024;
|
||||
#ifdef HAVE_MUTEX_SYSTEM_RESOURCES
|
||||
if (F_ISSET(dbenv, DB_ENV_THREAD))
|
||||
s += sizeof(REGMAINT) + TXN_MAINT_SIZE;
|
||||
#endif
|
||||
return (s);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_region_destroy
|
||||
* Destroy any region maintenance info.
|
||||
*
|
||||
* PUBLIC: void __txn_region_destroy __P((DB_ENV *, REGINFO *));
|
||||
*/
|
||||
void
|
||||
__txn_region_destroy(dbenv, infop)
|
||||
DB_ENV *dbenv;
|
||||
REGINFO *infop;
|
||||
{
|
||||
__db_shlocks_destroy(infop, (REGMAINT *)R_ADDR(infop,
|
||||
((DB_TXNREGION *)R_ADDR(infop, infop->rp->primary))->maint_off));
|
||||
|
||||
COMPQUIET(dbenv, NULL);
|
||||
COMPQUIET(infop, NULL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TEST
|
||||
/*
|
||||
* __txn_id_set --
|
||||
* Set the current transaction ID and current maximum unused ID (for
|
||||
* testing purposes only).
|
||||
*
|
||||
* PUBLIC: int __txn_id_set __P((DB_ENV *, u_int32_t, u_int32_t));
|
||||
*/
|
||||
int
|
||||
__txn_id_set(dbenv, cur_txnid, max_txnid)
|
||||
DB_ENV *dbenv;
|
||||
u_int32_t cur_txnid, max_txnid;
|
||||
{
|
||||
DB_TXNMGR *mgr;
|
||||
DB_TXNREGION *region;
|
||||
DB_TXN_STAT *stats;
|
||||
TXN_DETAIL *txnp;
|
||||
size_t nbytes;
|
||||
u_int32_t nactive, ndx;
|
||||
int ret, slop;
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_RPC
|
||||
if (F_ISSET(dbenv, DB_ENV_RPCCLIENT))
|
||||
return (__dbcl_txn_stat(dbenv, statp, db_malloc));
|
||||
#endif
|
||||
ENV_REQUIRES_CONFIG(dbenv, dbenv->tx_handle, "txn_id_set", DB_INIT_TXN);
|
||||
|
||||
PANIC_CHECK(dbenv);
|
||||
ENV_REQUIRES_CONFIG(dbenv, dbenv->tx_handle, DB_INIT_TXN);
|
||||
|
||||
*statp = NULL;
|
||||
|
||||
slop = 200;
|
||||
mgr = dbenv->tx_handle;
|
||||
region = mgr->reginfo.primary;
|
||||
region->last_txnid = cur_txnid;
|
||||
region->cur_maxid = max_txnid;
|
||||
|
||||
retry: R_LOCK(dbenv, &mgr->reginfo);
|
||||
nactive = region->nactive;
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
|
||||
/*
|
||||
* Allocate extra active structures to handle any transactions that
|
||||
* are created while we have the region unlocked.
|
||||
*/
|
||||
nbytes = sizeof(DB_TXN_STAT) + sizeof(DB_TXN_ACTIVE) * (nactive + slop);
|
||||
if ((ret = __os_malloc(dbenv, nbytes, db_malloc, &stats)) != 0)
|
||||
return (ret);
|
||||
|
||||
R_LOCK(dbenv, &mgr->reginfo);
|
||||
stats->st_last_txnid = region->last_txnid;
|
||||
stats->st_last_ckp = region->last_ckp;
|
||||
stats->st_maxtxns = region->maxtxns;
|
||||
stats->st_naborts = region->naborts;
|
||||
stats->st_nbegins = region->nbegins;
|
||||
stats->st_ncommits = region->ncommits;
|
||||
stats->st_pending_ckp = region->pending_ckp;
|
||||
stats->st_time_ckp = region->time_ckp;
|
||||
stats->st_nactive = region->nactive;
|
||||
if (stats->st_nactive > nactive + 200) {
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
slop *= 2;
|
||||
goto retry;
|
||||
ret = 0;
|
||||
if (cur_txnid < TXN_MINIMUM) {
|
||||
__db_err(dbenv, "Current ID value %lu below minimum",
|
||||
cur_txnid);
|
||||
ret = EINVAL;
|
||||
}
|
||||
stats->st_maxnactive = region->maxnactive;
|
||||
stats->st_txnarray = (DB_TXN_ACTIVE *)&stats[1];
|
||||
|
||||
ndx = 0;
|
||||
for (txnp = SH_TAILQ_FIRST(®ion->active_txn, __txn_detail);
|
||||
txnp != NULL;
|
||||
txnp = SH_TAILQ_NEXT(txnp, links, __txn_detail)) {
|
||||
stats->st_txnarray[ndx].txnid = txnp->txnid;
|
||||
if (txnp->parent == INVALID_ROFF)
|
||||
stats->st_txnarray[ndx].parentid = TXN_INVALID_ID;
|
||||
else
|
||||
stats->st_txnarray[ndx].parentid =
|
||||
((TXN_DETAIL *)R_ADDR(&mgr->reginfo,
|
||||
txnp->parent))->txnid;
|
||||
stats->st_txnarray[ndx].lsn = txnp->begin_lsn;
|
||||
ndx++;
|
||||
|
||||
if (ndx >= stats->st_nactive)
|
||||
break;
|
||||
if (max_txnid < TXN_MINIMUM) {
|
||||
__db_err(dbenv, "Maximum ID value %lu below minimum",
|
||||
max_txnid);
|
||||
ret = EINVAL;
|
||||
}
|
||||
|
||||
stats->st_region_wait = mgr->reginfo.rp->mutex.mutex_set_wait;
|
||||
stats->st_region_nowait = mgr->reginfo.rp->mutex.mutex_set_nowait;
|
||||
stats->st_regsize = mgr->reginfo.rp->size;
|
||||
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
|
||||
*statp = stats;
|
||||
return (0);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
102
bdb/txn/txn_stat.c
Normal file
102
bdb/txn/txn_stat.c
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1996-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: txn_stat.c,v 11.15 2002/04/26 23:00:36 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef NO_SYSTEM_INCLUDES
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "dbinc/txn.h"
|
||||
|
||||
/*
|
||||
* __txn_stat --
|
||||
*
|
||||
* PUBLIC: int __txn_stat __P((DB_ENV *, DB_TXN_STAT **, u_int32_t));
|
||||
*/
|
||||
int
|
||||
__txn_stat(dbenv, statp, flags)
|
||||
DB_ENV *dbenv;
|
||||
DB_TXN_STAT **statp;
|
||||
u_int32_t flags;
|
||||
{
|
||||
DB_TXNMGR *mgr;
|
||||
DB_TXNREGION *region;
|
||||
DB_TXN_STAT *stats;
|
||||
TXN_DETAIL *txnp;
|
||||
size_t nbytes;
|
||||
u_int32_t ndx;
|
||||
int ret;
|
||||
|
||||
PANIC_CHECK(dbenv);
|
||||
ENV_REQUIRES_CONFIG(dbenv, dbenv->tx_handle, "txn_stat", DB_INIT_TXN);
|
||||
|
||||
*statp = NULL;
|
||||
if ((ret = __db_fchk(dbenv,
|
||||
"DB_ENV->txn_stat", flags, DB_STAT_CLEAR)) != 0)
|
||||
return (ret);
|
||||
|
||||
mgr = dbenv->tx_handle;
|
||||
region = mgr->reginfo.primary;
|
||||
|
||||
/*
|
||||
* Allocate for the maximum active transactions -- the DB_TXN_ACTIVE
|
||||
* struct is small and the maximum number of active transactions is
|
||||
* not going to be that large. Don't have to lock anything to look
|
||||
* at the region's maximum active transactions value, it's read-only
|
||||
* and never changes after the region is created.
|
||||
*/
|
||||
nbytes = sizeof(DB_TXN_STAT) + sizeof(DB_TXN_ACTIVE) * region->maxtxns;
|
||||
if ((ret = __os_umalloc(dbenv, nbytes, &stats)) != 0)
|
||||
return (ret);
|
||||
|
||||
R_LOCK(dbenv, &mgr->reginfo);
|
||||
memcpy(stats, ®ion->stat, sizeof(*stats));
|
||||
stats->st_last_txnid = region->last_txnid;
|
||||
stats->st_last_ckp = region->last_ckp;
|
||||
stats->st_time_ckp = region->time_ckp;
|
||||
stats->st_txnarray = (DB_TXN_ACTIVE *)&stats[1];
|
||||
|
||||
ndx = 0;
|
||||
for (txnp = SH_TAILQ_FIRST(®ion->active_txn, __txn_detail);
|
||||
txnp != NULL;
|
||||
txnp = SH_TAILQ_NEXT(txnp, links, __txn_detail)) {
|
||||
stats->st_txnarray[ndx].txnid = txnp->txnid;
|
||||
if (txnp->parent == INVALID_ROFF)
|
||||
stats->st_txnarray[ndx].parentid = TXN_INVALID;
|
||||
else
|
||||
stats->st_txnarray[ndx].parentid =
|
||||
((TXN_DETAIL *)R_ADDR(&mgr->reginfo,
|
||||
txnp->parent))->txnid;
|
||||
stats->st_txnarray[ndx].lsn = txnp->begin_lsn;
|
||||
ndx++;
|
||||
}
|
||||
|
||||
stats->st_region_wait = mgr->reginfo.rp->mutex.mutex_set_wait;
|
||||
stats->st_region_nowait = mgr->reginfo.rp->mutex.mutex_set_nowait;
|
||||
stats->st_regsize = mgr->reginfo.rp->size;
|
||||
if (LF_ISSET(DB_STAT_CLEAR)) {
|
||||
mgr->reginfo.rp->mutex.mutex_set_wait = 0;
|
||||
mgr->reginfo.rp->mutex.mutex_set_nowait = 0;
|
||||
memset(®ion->stat, 0, sizeof(region->stat));
|
||||
region->stat.st_maxtxns = region->maxtxns;
|
||||
region->stat.st_maxnactive =
|
||||
region->stat.st_nactive = stats->st_nactive;
|
||||
}
|
||||
|
||||
R_UNLOCK(dbenv, &mgr->reginfo);
|
||||
|
||||
*statp = stats;
|
||||
return (0);
|
||||
}
|
||||
234
bdb/txn/txn_util.c
Normal file
234
bdb/txn/txn_util.c
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 2001-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: txn_util.c,v 11.18 2002/08/06 06:25:12 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef NO_SYSTEM_INCLUDES
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "dbinc/db_shash.h"
|
||||
#include "dbinc/lock.h"
|
||||
#include "dbinc/txn.h"
|
||||
|
||||
typedef struct __txn_event TXN_EVENT;
|
||||
struct __txn_event {
|
||||
TXN_EVENT_T op;
|
||||
TAILQ_ENTRY(__txn_event) links;
|
||||
union {
|
||||
struct {
|
||||
/* Delayed remove. */
|
||||
char *name;
|
||||
u_int8_t *fileid;
|
||||
} r;
|
||||
struct {
|
||||
/* Lock event. */
|
||||
DB_LOCK lock;
|
||||
u_int32_t locker;
|
||||
DB *dbp;
|
||||
} t;
|
||||
} u;
|
||||
};
|
||||
|
||||
/*
|
||||
* __txn_remevent --
|
||||
*
|
||||
* Creates a remove event that can be added to the commit list.
|
||||
*
|
||||
* PUBLIC: int __txn_remevent __P((DB_ENV *,
|
||||
* PUBLIC: DB_TXN *, const char *, u_int8_t*));
|
||||
*/
|
||||
int
|
||||
__txn_remevent(dbenv, txn, name, fileid)
|
||||
DB_ENV *dbenv;
|
||||
DB_TXN *txn;
|
||||
const char *name;
|
||||
u_int8_t *fileid;
|
||||
{
|
||||
int ret;
|
||||
TXN_EVENT *e;
|
||||
|
||||
e = NULL;
|
||||
if ((ret = __os_calloc(dbenv, 1, sizeof(TXN_EVENT), &e)) != 0)
|
||||
return (ret);
|
||||
|
||||
if ((ret = __os_strdup(dbenv, name, &e->u.r.name)) != 0)
|
||||
goto err;
|
||||
|
||||
if (fileid != NULL) {
|
||||
if ((ret = __os_calloc(dbenv,
|
||||
1, DB_FILE_ID_LEN, &e->u.r.fileid)) != 0)
|
||||
return (ret);
|
||||
memcpy(e->u.r.fileid, fileid, DB_FILE_ID_LEN);
|
||||
}
|
||||
|
||||
e->op = TXN_REMOVE;
|
||||
TAILQ_INSERT_TAIL(&txn->events, e, links);
|
||||
|
||||
return (0);
|
||||
|
||||
err: if (e != NULL)
|
||||
__os_free(dbenv, e);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_lockevent --
|
||||
*
|
||||
* Add a lockevent to the commit-queue. The lock event indicates a locker
|
||||
* trade.
|
||||
*
|
||||
* PUBLIC: int __txn_lockevent __P((DB_ENV *,
|
||||
* PUBLIC: DB_TXN *, DB *, DB_LOCK *, u_int32_t));
|
||||
*/
|
||||
int
|
||||
__txn_lockevent(dbenv, txn, dbp, lock, locker)
|
||||
DB_ENV *dbenv;
|
||||
DB_TXN *txn;
|
||||
DB *dbp;
|
||||
DB_LOCK *lock;
|
||||
u_int32_t locker;
|
||||
{
|
||||
int ret;
|
||||
TXN_EVENT *e;
|
||||
|
||||
if (!LOCKING_ON(dbenv))
|
||||
return (0);
|
||||
|
||||
e = NULL;
|
||||
if ((ret = __os_calloc(dbenv, 1, sizeof(TXN_EVENT), &e)) != 0)
|
||||
return (ret);
|
||||
|
||||
e->u.t.locker = locker;
|
||||
e->u.t.lock = *lock;
|
||||
e->u.t.dbp = dbp;
|
||||
e->op = TXN_TRADE;
|
||||
TAILQ_INSERT_TAIL(&txn->events, e, links);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_remlock --
|
||||
* Remove a lock event because the locker is going away. We can remove
|
||||
* by lock (using offset) or by locker_id (or by both).
|
||||
*
|
||||
* PUBLIC: void __txn_remlock __P((DB_ENV *, DB_TXN *, DB_LOCK *, u_int32_t));
|
||||
*/
|
||||
void
|
||||
__txn_remlock(dbenv, txn, lock, locker)
|
||||
DB_ENV *dbenv;
|
||||
DB_TXN *txn;
|
||||
DB_LOCK *lock;
|
||||
u_int32_t locker;
|
||||
{
|
||||
TXN_EVENT *e, *next_e;
|
||||
|
||||
for (e = TAILQ_FIRST(&txn->events); e != NULL; e = next_e) {
|
||||
next_e = TAILQ_NEXT(e, links);
|
||||
if ((e->op != TXN_TRADE && e->op != TXN_TRADED) ||
|
||||
(e->u.t.lock.off != lock->off && e->u.t.locker != locker))
|
||||
continue;
|
||||
TAILQ_REMOVE(&txn->events, e, links);
|
||||
__os_free(dbenv, e);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* __txn_doevents --
|
||||
* Process the list of events associated with a transaction. On commit,
|
||||
* apply the events; on abort, just toss the entries.
|
||||
*
|
||||
* PUBLIC: int __txn_doevents __P((DB_ENV *, DB_TXN *, int, int));
|
||||
*/
|
||||
#define DO_TRADE do { \
|
||||
memset(&req, 0, sizeof(req)); \
|
||||
req.lock = e->u.t.lock; \
|
||||
req.op = DB_LOCK_TRADE; \
|
||||
t_ret = __lock_vec(dbenv, e->u.t.locker, 0, &req, 1, NULL); \
|
||||
if (t_ret == 0) \
|
||||
e->u.t.dbp->cur_lid = e->u.t.locker; \
|
||||
else if (t_ret == DB_NOTFOUND) \
|
||||
t_ret = 0; \
|
||||
if (t_ret != 0 && ret == 0) \
|
||||
ret = t_ret; \
|
||||
e->op = TXN_TRADED; \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
__txn_doevents(dbenv, txn, is_commit, preprocess)
|
||||
DB_ENV *dbenv;
|
||||
DB_TXN *txn;
|
||||
int is_commit, preprocess;
|
||||
{
|
||||
DB_LOCKREQ req;
|
||||
TXN_EVENT *e;
|
||||
int ret, t_ret;
|
||||
|
||||
ret = 0;
|
||||
|
||||
/*
|
||||
* This phase only gets called if we have a phase where we
|
||||
* release read locks. Since not all paths will call this
|
||||
* phase, we have to check for it below as well. So, when
|
||||
* we do the trade, we update the opcode of the entry so that
|
||||
* we don't try the trade again.
|
||||
*/
|
||||
if (preprocess) {
|
||||
for (e = TAILQ_FIRST(&txn->events);
|
||||
e != NULL; e = TAILQ_NEXT(e, links)) {
|
||||
if (e->op != TXN_TRADE)
|
||||
continue;
|
||||
DO_TRADE;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
while ((e = TAILQ_FIRST(&txn->events)) != NULL) {
|
||||
TAILQ_REMOVE(&txn->events, e, links);
|
||||
if (!is_commit)
|
||||
goto dofree;
|
||||
switch (e->op) {
|
||||
case TXN_REMOVE:
|
||||
if (e->u.r.fileid != NULL) {
|
||||
if ((t_ret = dbenv->memp_nameop(dbenv,
|
||||
e->u.r.fileid,
|
||||
NULL, e->u.r.name, NULL)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
__os_free(dbenv, e->u.r.fileid);
|
||||
} else if ((t_ret =
|
||||
__os_unlink(dbenv, e->u.r.name)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
__os_free(dbenv, e->u.r.name);
|
||||
break;
|
||||
case TXN_TRADE:
|
||||
DO_TRADE;
|
||||
/* Fall through */
|
||||
case TXN_TRADED:
|
||||
/* Downgrade the lock. */
|
||||
if ((t_ret = __lock_downgrade(dbenv,
|
||||
&e->u.t.lock, DB_LOCK_READ, 0)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
break;
|
||||
default:
|
||||
/* This had better never happen. */
|
||||
DB_ASSERT(0);
|
||||
}
|
||||
dofree: __os_free(dbenv, e);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue