summaryrefslogtreecommitdiff
path: root/bdb/test/test073.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/test073.tcl')
-rw-r--r--bdb/test/test073.tcl77
1 files changed, 51 insertions, 26 deletions
diff --git a/bdb/test/test073.tcl b/bdb/test/test073.tcl
index 12a48b0e412..02a0f3b0d19 100644
--- a/bdb/test/test073.tcl
+++ b/bdb/test/test073.tcl
@@ -1,25 +1,27 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 1999, 2000
+# Copyright (c) 1999-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: test073.tcl,v 11.17 2000/12/11 17:24:55 sue Exp $
+# $Id: test073.tcl,v 11.23 2002/05/22 15:42:59 sue Exp $
#
-# DB Test 73: Test of cursor stability on duplicate pages.
-# 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 test073
+# TEST Test of cursor stability on duplicate pages.
+# TEST
+# TEST Does the following:
+# TEST a. Initialize things by DB->putting ndups dups and
+# TEST setting a reference cursor to point to each.
+# 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 test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
source ./include.tcl
global alphabet
@@ -27,6 +29,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
set omethod [convert_method $method]
set args [convert_args $method $args]
+ set txnenv 0
set eindex [lsearch -exact $args "-env"]
#
# If we are using an env, then testfile should just be the db name.
@@ -38,11 +41,16 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
set testfile test0$tnum.db
incr eindex
set env [lindex $args $eindex]
+ set txnenv [is_txnenv $env]
+ if { $txnenv == 1 } {
+ append args " -auto_commit "
+ }
+ set testdir [get_home $env]
}
cleanup $testdir $env
set key "the key"
-
+ set txn ""
puts -nonewline "Test0$tnum $omethod ($args): "
if { [is_record_based $method] || [is_rbtree $method] } {
@@ -60,7 +68,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
append args " -pagesize $pagesize -dup"
set db [eval {berkdb_open \
- -create -truncate -mode 0644} $omethod $args $testfile]
+ -create -mode 0644} $omethod $args $testfile]
error_check_good "db open" [is_valid_db $db] TRUE
# Number of outstanding keys.
@@ -71,17 +79,31 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
for { set i 0 } { $i < $ndups } { incr i } {
set datum [makedatum_t73 $i 0]
- error_check_good "db put ($i)" [$db put $key $datum] 0
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
+ set ret [eval {$db put} $txn {$key $datum}]
+ error_check_good "db put ($i)" $ret 0
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
set is_long($i) 0
incr keys
}
puts "\tTest0$tnum.a.2: Initializing cursor get loop; $keys dups."
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
for { set i 0 } { $i < $keys } { incr i } {
set datum [makedatum_t73 $i 0]
- set dbc($i) [$db cursor]
+ set dbc($i) [eval {$db cursor} $txn]
error_check_good "db cursor ($i)"\
[is_valid_cursor $dbc($i) $db] TRUE
error_check_good "dbc get -get_both ($i)"\
@@ -97,7 +119,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
# to be added (since they start from zero)
set datum [makedatum_t73 $keys 0]
- set curs [$db cursor]
+ set curs [eval {$db cursor} $txn]
error_check_good "db cursor create" [is_valid_cursor $curs $db]\
TRUE
error_check_good "c_put(DB_KEYLAST, $keys)"\
@@ -118,7 +140,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
# to be added (since they start from zero)
set datum [makedatum_t73 $keys 0]
- set curs [$db cursor]
+ set curs [eval {$db cursor} $txn]
error_check_good "db cursor create" [is_valid_cursor $curs $db]\
TRUE
error_check_good "c_put(DB_KEYFIRST, $keys)"\
@@ -138,7 +160,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
set keysnow $keys
for { set i 0 } { $i < $keysnow } { incr i } {
set datum [makedatum_t73 $keys 0]
- set curs [$db cursor]
+ set curs [eval {$db cursor} $txn]
error_check_good "db cursor create" [is_valid_cursor $curs $db]\
TRUE
@@ -162,7 +184,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
for { set i [expr $keys - 1] } { $i >= 0 } { incr i -1 } {
set datum [makedatum_t73 $keys 0]
- set curs [$db cursor]
+ set curs [eval {$db cursor} $txn]
error_check_good "db cursor create" [is_valid_cursor $curs $db]\
TRUE
@@ -190,7 +212,7 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
for { set i 0 } { $i < $keysnow } { incr i } {
set olddatum [makedatum_t73 $i 0]
set newdatum [makedatum_t73 $i 1]
- set curs [$db cursor]
+ set curs [eval {$db cursor} $txn]
error_check_good "db cursor create" [is_valid_cursor $curs $db]\
TRUE
@@ -215,6 +237,9 @@ proc test073 { method {pagesize 512} {ndups 50} {tnum 73} args } {
for { set i 0 } { $i < $keys } { incr i } {
error_check_good "dbc close ($i)" [$dbc($i) close] 0
}
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
error_check_good "db close" [$db close] 0
}