1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996-2002
4
# Sleepycat Software. All rights reserved.
8
# Recd15 - lots of txns - txn prepare script
9
# Usage: recd15script envcmd dbcmd gidf numtxns
10
# envcmd: command to open env
11
# dbfile: name of database file
12
# gidf: name of global id file
13
# numtxns: number of txns to start
16
source $test_path/test.tcl
17
source $test_path/testutils.tcl
19
set usage "recd15script envcmd dbfile gidfile numtxns"
23
puts stderr "FAIL:[timestamp] Usage: $usage"
27
# Initialize arguments
28
set envcmd [ lindex $argv 0 ]
29
set dbfile [ lindex $argv 1 ]
30
set gidfile [ lindex $argv 2 ]
31
set numtxns [ lindex $argv 3 ]
33
set txnmax [expr $numtxns + 5]
34
set dbenv [eval $envcmd]
35
error_check_good envopen [is_valid_env $dbenv] TRUE
38
if { $dbfile != "NULL" } {
40
set db [berkdb_open -auto_commit -env $dbenv $dbfile]
41
error_check_good dbopen [is_valid_db $db] TRUE
44
puts "\tRecd015script.a: Begin $numtxns txns"
45
for {set i 0} {$i < $numtxns} {incr i} {
47
error_check_good txnbegin($i) [is_valid_txn $t $dbenv] TRUE
50
set dbc [$db cursor -txn $t]
51
error_check_good cursor($i) [is_valid_cursor $dbc $db] TRUE
56
puts "\tRecd015script.b: Prepare $numtxns txns"
57
set gfd [open $gidfile w+]
58
for {set i 0} {$i < $numtxns} {incr i} {
61
error_check_good dbc_close [$dbc close] 0
64
set gid [make_gid recd015script:$t]
66
error_check_good txn_prepare:$t [$t prepare $gid] 0
71
# We do not close the db or env, but exit with the txns outstanding.
73
puts "\tRecd015script completed successfully"