summaryrefslogtreecommitdiff
path: root/bdb/test/test087.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/test087.tcl')
-rw-r--r--bdb/test/test087.tcl82
1 files changed, 47 insertions, 35 deletions
diff --git a/bdb/test/test087.tcl b/bdb/test/test087.tcl
index 7096e6c1cb9..089664a0002 100644
--- a/bdb/test/test087.tcl
+++ b/bdb/test/test087.tcl
@@ -1,31 +1,38 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 1999, 2000
+# Copyright (c) 1999-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: test087.tcl,v 11.6 2000/12/11 17:24:55 sue Exp $
+# $Id: test087.tcl,v 11.14 2002/07/08 20:16:31 sue Exp $
#
-# DB Test 87: Test of cursor stability on duplicate pages w/aborts.
-# Does the following:
-# a. Initialize things by DB->putting ndups dups and
-# setting a reference cursor to point to each.
-# b. c_put ndups dups (and correspondingly expanding
-# the set of reference cursors) after the last one, making sure
-# after each step that all the reference cursors still point to
-# the right item.
-# c. Ditto, but before the first one.
-# d. Ditto, but after each one in sequence first to last.
-# e. Ditto, but after each one in sequence from last to first.
-# occur relative to the new datum)
-# f. Ditto for the two sequence tests, only doing a
-# DBC->c_put(DB_CURRENT) of a larger datum instead of adding a
-# new one.
+# TEST test087
+# TEST Test of cursor stability when converting to and modifying
+# TEST off-page duplicate pages with subtransaction aborts. [#2373]
+# TEST
+# TEST Does the following:
+# TEST a. Initialize things by DB->putting ndups dups and
+# TEST setting a reference cursor to point to each. Do each put twice,
+# TEST first aborting, then committing, so we're sure to abort the move
+# TEST to off-page dups at some point.
+# TEST b. c_put ndups dups (and correspondingly expanding
+# TEST the set of reference cursors) after the last one, making sure
+# TEST after each step that all the reference cursors still point to
+# TEST the right item.
+# TEST c. Ditto, but before the first one.
+# TEST d. Ditto, but after each one in sequence first to last.
+# TEST e. Ditto, but after each one in sequence from last to first.
+# TEST occur relative to the new datum)
+# TEST f. Ditto for the two sequence tests, only doing a
+# TEST DBC->c_put(DB_CURRENT) of a larger datum instead of adding a
+# TEST new one.
proc test087 { method {pagesize 512} {ndups 50} {tnum 87} args } {
source ./include.tcl
global alphabet
- set omethod [convert_method $method]
set args [convert_args $method $args]
+ set encargs ""
+ set args [split_encargs $args encargs]
+ set omethod [convert_method $method]
puts "Test0$tnum $omethod ($args): "
set eindex [lsearch -exact $args "-env"]
@@ -52,34 +59,38 @@ proc test087 { method {pagesize 512} {ndups 50} {tnum 87} args } {
puts "Cursor stability on dup. pages w/ aborts."
}
- set env [berkdb env -create -home $testdir -txn]
+ set env [eval {berkdb_env -create -home $testdir -txn} $encargs]
error_check_good env_create [is_valid_env $env] TRUE
- set db [eval {berkdb_open -env $env \
- -create -mode 0644} $omethod $args $testfile]
+ set db [eval {berkdb_open -auto_commit \
+ -create -env $env -mode 0644} $omethod $args $testfile]
error_check_good "db open" [is_valid_db $db] TRUE
# Number of outstanding keys.
- set keys 0
+ set keys $ndups
- puts "\tTest0$tnum.a.1: Initializing put loop; $ndups dups, short data."
+ puts "\tTest0$tnum.a: put/abort/put/commit loop;\
+ $ndups dups, short data."
set txn [$env txn]
error_check_good txn [is_valid_txn $txn $env] TRUE
for { set i 0 } { $i < $ndups } { incr i } {
set datum [makedatum_t73 $i 0]
- error_check_good "db put ($i)" [$db put -txn $txn $key $datum] 0
+ set ctxn [$env txn -parent $txn]
+ error_check_good ctxn(abort,$i) [is_valid_txn $ctxn $env] TRUE
+ error_check_good "db put/abort ($i)" \
+ [$db put -txn $ctxn $key $datum] 0
+ error_check_good ctxn_abort($i) [$ctxn abort] 0
- set is_long($i) 0
- incr keys
- }
- error_check_good txn_commit [$txn commit] 0
+ verify_t73 is_long dbc [expr $i - 1] $key
- puts "\tTest0$tnum.a.2: Initializing cursor get loop; $keys dups."
- set txn [$env txn]
- error_check_good txn [is_valid_txn $txn $env] TRUE
- for { set i 0 } { $i < $keys } { incr i } {
- set datum [makedatum_t73 $i 0]
+ set ctxn [$env txn -parent $txn]
+ error_check_good ctxn(commit,$i) [is_valid_txn $ctxn $env] TRUE
+ error_check_good "db put/commit ($i)" \
+ [$db put -txn $ctxn $key $datum] 0
+ error_check_good ctxn_commit($i) [$ctxn commit] 0
+
+ set is_long($i) 0
set dbc($i) [$db cursor -txn $txn]
error_check_good "db cursor ($i)"\
@@ -87,6 +98,8 @@ proc test087 { method {pagesize 512} {ndups 50} {tnum 87} args } {
error_check_good "dbc get -get_both ($i)"\
[$dbc($i) get -get_both $key $datum]\
[list [list $key $datum]]
+
+ verify_t73 is_long dbc $i $key
}
puts "\tTest0$tnum.b: Cursor put (DB_KEYLAST); $ndups new dups,\
@@ -97,7 +110,6 @@ proc test087 { method {pagesize 512} {ndups 50} {tnum 87} args } {
for { set i 0 } { $i < $ndups } { incr i } {
# !!! keys contains the number of the next dup
# to be added (since they start from zero)
-
set datum [makedatum_t73 $keys 0]
set curs [$db cursor -txn $ctxn]
error_check_good "db cursor create" [is_valid_cursor $curs $db]\
@@ -272,7 +284,7 @@ proc test087 { method {pagesize 512} {ndups 50} {tnum 87} args } {
for { set i 0 } { $i < $keys } { incr i } {
error_check_good "dbc close ($i)" [$dbc($i) close] 0
}
- error_check_good txn_commit [$txn commit] 0
error_check_good "db close" [$db close] 0
+ error_check_good txn_commit [$txn commit] 0
error_check_good "env close" [$env close] 0
}