summaryrefslogtreecommitdiff
path: root/bdb/test/test006.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/test006.tcl')
-rw-r--r--bdb/test/test006.tcl64
1 files changed, 48 insertions, 16 deletions
diff --git a/bdb/test/test006.tcl b/bdb/test/test006.tcl
index 9364d2a4f60..fbaebfe8ac8 100644
--- a/bdb/test/test006.tcl
+++ b/bdb/test/test006.tcl
@@ -1,14 +1,18 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 1996, 1997, 1998, 1999, 2000
+# Copyright (c) 1996-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: test006.tcl,v 11.13 2000/08/25 14:21:54 sue Exp $
+# $Id: test006.tcl,v 11.19 2002/05/22 15:42:44 sue Exp $
#
-# DB Test 6 {access method}
-# Keyed delete test.
-# Create database.
-# Go through database, deleting all entries by key.
+# TEST test006
+# TEST Small keys/medium data
+# TEST Put/get per key
+# TEST Keyed delete and verify
+# TEST
+# TEST Keyed delete test.
+# TEST Create database.
+# TEST Go through database, deleting all entries by key.
proc test006 { method {nentries 10000} {reopen 0} {tnum 6} args} {
source ./include.tcl
@@ -23,15 +27,8 @@ proc test006 { method {nentries 10000} {reopen 0} {tnum 6} args} {
set tname Test0$tnum
set dbname test0$tnum
}
- puts -nonewline "$tname: $method ($args) "
- puts -nonewline "$nentries equal small key; medium data pairs"
- if {$reopen == 1} {
- puts " (with close)"
- } else {
- puts ""
- }
-
# Create the database and open the dictionary
+ set txnenv 0
set eindex [lsearch -exact $args "-env"]
#
# If we are using an env, then testfile should just be the db name.
@@ -43,6 +40,25 @@ proc test006 { method {nentries 10000} {reopen 0} {tnum 6} args} {
set testfile $dbname.db
incr eindex
set env [lindex $args $eindex]
+ set txnenv [is_txnenv $env]
+ if { $txnenv == 1 } {
+ append args " -auto_commit "
+ #
+ # If we are using txns and running with the
+ # default, set the default down a bit.
+ #
+ if { $nentries == 10000 } {
+ set nentries 100
+ }
+ }
+ set testdir [get_home $env]
+ }
+ puts -nonewline "$tname: $method ($args) "
+ puts -nonewline "$nentries equal small key; medium data pairs"
+ if {$reopen == 1} {
+ puts " (with close)"
+ } else {
+ puts ""
}
set pflags ""
@@ -50,14 +66,14 @@ proc test006 { method {nentries 10000} {reopen 0} {tnum 6} args} {
set txn ""
set count 0
if { [is_record_based $method] == 1 } {
- append gflags " -recno"
+ append gflags " -recno"
}
# Here is the loop where we put and get each key/data pair
cleanup $testdir $env
set db [eval {berkdb_open \
- -create -truncate -mode 0644} $args {$omethod $testfile}]
+ -create -mode 0644} $args {$omethod $testfile}]
error_check_good dbopen [is_valid_db $db] TRUE
set did [open $dict]
@@ -70,9 +86,17 @@ proc test006 { method {nentries 10000} {reopen 0} {tnum 6} args} {
set datastr [make_data_str $str]
+ 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 $pflags {$key [chop_data $method $datastr]}]
error_check_good put $ret 0
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
set ret [eval {$db get} $gflags {$key}]
error_check_good "$tname: put $datastr got $ret" \
@@ -108,8 +132,16 @@ proc test006 { method {nentries 10000} {reopen 0} {tnum 6} args} {
error_check_good "$tname: get $datastr got $ret" \
$ret [list [list $key [pad_data $method $datastr]]]
+ 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 del} $txn {$key}]
error_check_good db_del:$key $ret 0
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
incr count
}
close $did