proc recd017 { method {select 0} args} {
global fixed_len
global encrypt
global passwd
global has_crypto
source ./include.tcl
if { $has_crypto == 0 } {
puts "Skipping recd017 for non-crypto release."
return
}
set orig_fixed_len $fixed_len
set opts [convert_args $method $args]
set omethod [convert_method $method]
puts "Recd017: $method operation/transaction tests"
env_cleanup $testdir
set testfile recd017.db
set testfile2 recd017-2.db
set flags "-create -encryptaes $passwd -txn -home $testdir"
puts "\tRecd017.a.0: creating environment"
set env_cmd "berkdb_env $flags"
convert_encrypt $env_cmd
set dbenv [eval $env_cmd]
error_check_good dbenv [is_valid_env $dbenv] TRUE
set oflags "-create $omethod -mode 0644 \
-env $dbenv -encrypt $opts $testfile"
set db [eval {berkdb_open} $oflags]
error_check_good db_open [is_valid_db $db] TRUE
set stat [$db stat]
set pg [get_pagesize $stat]
error_check_bad get_pagesize $pg -1
set fixed_len [expr $pg / 4]
error_check_good db_close [$db close] 0
error_check_good dbremove [berkdb dbremove -env $dbenv $testfile] 0
set opts [convert_args $method ""]
convert_encrypt $env_cmd
set omethod [convert_method $method]
set oflags "-create $omethod -mode 0644 \
-env $dbenv -encrypt $opts $testfile"
set db [eval {berkdb_open} $oflags]
error_check_good db_open [is_valid_db $db] TRUE
error_check_good db_close [$db close] 0
set oflags "-create $omethod -mode 0644 \
-env $dbenv -encrypt $opts $testfile2"
set db [eval {berkdb_open} $oflags]
error_check_good db_open [is_valid_db $db] TRUE
error_check_good db_close [$db close] 0
error_check_good env_close [$dbenv close] 0
puts "\tRecd017.a.1: Verify db_printlog can read logfile"
set tmpfile $testdir/printlog.out
set stat [catch {exec $util_path/db_printlog -h $testdir -P $passwd \
> $tmpfile} ret]
error_check_good db_printlog $stat 0
fileremove $tmpfile
set rlist {
{ {DB put -txn TXNID $key $data} "Recd017.b: put"}
{ {DB del -txn TXNID $key} "Recd017.c: delete"}
}
if { [is_record_based $method] == 1 } {
set key 1
} else {
set key recd017_key
}
set data recd017_data
foreach pair $rlist {
set cmd [subst [lindex $pair 0]]
set msg [lindex $pair 1]
if { $select != 0 } {
set tag [lindex $msg 0]
set tail [expr [string length $tag] - 2]
set tag [string range $tag $tail $tail]
if { [lsearch $select $tag] == -1 } {
continue
}
}
if { [is_queue $method] != 1 } {
if { [string first append $cmd] != -1 } {
continue
}
if { [string first consume $cmd] != -1 } {
continue
}
}
op_recover abort $testdir $env_cmd $testfile $cmd $msg
op_recover commit $testdir $env_cmd $testfile $cmd $msg
op_recover prepare-abort $testdir $env_cmd $testfile2 \
$cmd $msg
op_recover prepare-discard $testdir $env_cmd $testfile2 \
$cmd $msg
op_recover prepare-commit $testdir $env_cmd $testfile2 \
$cmd $msg
}
set fixed_len $orig_fixed_len
return
}