1 # See the file LICENSE for redistribution information.
3 # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
8 # TEST Begin, commit, abort testing.
9 proc txn001 { {tnum "001"} { max 1024 } { ntxns 50 } } {
14 puts -nonewline "Txn$tnum: Basic begin, commit, abort"
16 if { $tnum != "001"} {
17 puts " (with ID wrap)"
25 set env [eval {berkdb_env -create -mode 0644 -txn \
26 -txn_max $max -home $testdir}]
27 error_check_good evn_open [is_valid_env $env] TRUE
28 error_check_good txn_id_set \
29 [ $env txn_id_set $txn_curid $txn_maxid ] 0
30 txn001_suba $ntxns $env $tnum
31 txn001_subb $ntxns $env $tnum
32 txn001_subc $ntxns $env $tnum
33 # Close and unlink the file
34 error_check_good env_close:$env [$env close] 0
37 proc txn001_suba { ntxns env tnum } {
40 # We will create a bunch of transactions and commit them.
43 puts "\tTxn$tnum.a: Beginning/Committing $ntxns Transactions in $env"
44 for { set i 0 } { $i < $ntxns } { incr i } {
46 error_check_good txn_begin [is_valid_txn $txn $env] TRUE
51 error_check_good tid_check [lsearch $tid_list $tid] -1
58 error_check_good txn_commit:$t [$t commit] 0
62 proc txn001_subb { ntxns env tnum } {
63 # We will create a bunch of transactions and abort them.
66 puts "\tTxn$tnum.b: Beginning/Aborting Transactions"
67 for { set i 0 } { $i < $ntxns } { incr i } {
69 error_check_good txn_begin [is_valid_txn $txn $env] TRUE
74 error_check_good tid_check [lsearch $tid_list $tid] -1
81 error_check_good txn_abort:$t [$t abort] 0
85 proc txn001_subc { ntxns env tnum } {
86 # We will create a bunch of transactions and commit them.
89 puts "\tTxn$tnum.c: Beginning/Prepare/Committing Transactions"
90 for { set i 0 } { $i < $ntxns } { incr i } {
92 error_check_good txn_begin [is_valid_txn $txn $env] TRUE
97 error_check_good tid_check [lsearch $tid_list $tid] -1
102 # Now prepare them all
103 foreach t $txn_list {
104 error_check_good txn_prepare:$t \
105 [$t prepare [make_gid global:$t]] 0
108 # Now commit them all
109 foreach t $txn_list {
110 error_check_good txn_commit:$t [$t commit] 0