proc test120 { method {tnum "120"} args } {
source ./include.tcl
set eindex [lsearch -exact $args "-env"]
if { $eindex != -1 } {
incr eindex
set env [lindex $args $eindex]
puts "Test$tnum skipping for env $env"
return
}
if { [is_queue $method] == 1 } {
puts "Test$tnum skipping for method $method"
return
}
puts "\tTest$tnum ($method): MVCC and blocking."
set args [convert_args $method $args]
set omethod [convert_method $method]
set encargs ""
set args [split_encargs $args encargs]
set filename "test.db"
env_cleanup $testdir
puts "\tTest$tnum.a: Creating txn env."
set env [eval {berkdb_env}\
-create -txn -multiversion $encargs -home $testdir]
error_check_good env_open [is_valid_env $env] TRUE
puts "\tTest$tnum.b: Creating -multiversion db."
set db [eval {berkdb_open} \
-create -auto_commit -env $env $omethod $args $filename]
error_check_good db_open [is_valid_db $db] TRUE
puts "\tTest$tnum.c: Start transactions."
set t1 [$env txn]
set txn1 "-txn $t1"
set t2 [$env txn -snapshot]
set txn2 "-txn $t2"
set key 1
set data DATA
error_check_good \
t1_put [eval {$db put} $txn1 $key [chop_data $method $data]] 0
puts "\tTest$tnum.d: Txn2 can't see txn1's put."
set ret [eval {$db get} $txn2 $key]
error_check_good txn2_get [llength $ret] 0
error_check_good t1_commit [$t1 commit] 0
set ret [eval {$db get} $txn2 $key]
error_check_good txn2_get [llength $ret] 0
error_check_good db_sync [$db sync] 0
set ret [eval {$db get} $txn2 $key]
error_check_good txn2_get [llength $ret] 0
puts "\tTest$tnum.e: A new txn can see txn1's put."
set t3 [$env txn -snapshot]
set txn3 "-txn $t3"
set ret [eval {$db get} $txn3 $key]
error_check_good \
t3_get $ret [list [list $key [pad_data $method $data]]]
error_check_good t2_commit [$t2 commit] 0
error_check_good t3_commit [$t3 commit] 0
error_check_good db_close [$db close] 0
error_check_good env_close [$env close] 0
}