1 # See the file LICENSE for redistribution information.
3 # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
8 # TEST Big key test where big key gets elevated to internal page.
9 proc recd004 { method {select 0} args } {
14 set zero_idx [lsearch -exact $args "-zero_log"]
15 if { $zero_idx != -1 } {
16 set args [lreplace $args $zero_idx $zero_idx]
17 set envargs "-zero_log"
20 set opts [convert_args $method $args]
21 set omethod [convert_method $method]
23 set pgindex [lsearch -exact $args "-pagesize"]
24 if { $pgindex != -1 } {
25 puts "Recd004: skipping for specific pagesizes"
28 if { [is_record_based $method] == 1 } {
29 puts "Recd004 skipping for method $method"
32 puts "Recd004: $method big-key on internal page recovery tests ($envargs)"
34 berkdb srand $rand_init
37 set testfile recd004.db
38 set testfile2 recd004-2.db
39 set eflags "-create -txn wrnosync -home $testdir $envargs"
40 puts "\tRecd004.a: creating environment"
41 set env_cmd "berkdb_env $eflags"
42 set dbenv [eval $env_cmd]
43 error_check_bad dbenv $dbenv NULL
45 # Create the databases. We will use a small page size so that we
47 set oflags "-create -mode 0644 \
48 -auto_commit $omethod -env $dbenv $opts -pagesize 512 $testfile"
49 set db [eval {berkdb_open} $oflags]
50 error_check_bad db_open $db NULL
51 error_check_good db_open [is_substr $db db] 1
52 error_check_good db_close [$db close] 0
53 set oflags "-create -mode 0644 \
54 -auto_commit $omethod -env $dbenv $opts -pagesize 512 $testfile2"
55 set db [eval {berkdb_open} $oflags]
56 error_check_bad db_open $db NULL
57 error_check_good db_open [is_substr $db db] 1
58 error_check_good db_close [$db close] 0
61 # List of recovery tests: {CMD MSG} pairs
63 { {big_populate DB TXNID $n} "Recd004.b: big key elevation"}
64 { {unpopulate DB TXNID 0} "Recd004.c: Remove keys"}
67 # If pages are 512 bytes, then adding 512 key/data pairs
68 # should be more than sufficient.
71 set cmd [subst [lindex $pair 0]]
72 set msg [lindex $pair 1]
74 set tag [lindex $msg 0]
75 set tail [expr [string length $tag] - 2]
76 set tag [string range $tag $tail $tail]
77 if { [lsearch $select $tag] == -1 } {
82 $testdir $env_cmd $testfile $cmd $msg $opts
84 $testdir $env_cmd $testfile $cmd $msg $opts
86 # Note that since prepare-discard ultimately aborts
87 # the txn, it must come before prepare-commit.
89 op_recover prepare-abort $testdir $env_cmd $testfile2 \
91 op_recover prepare-discard $testdir $env_cmd $testfile2 \
93 op_recover prepare-commit $testdir $env_cmd $testfile2 \
97 puts "\tRecd004.d: Verify db_printlog can read logfile"
98 set tmpfile $testdir/printlog.out
99 set stat [catch {exec $util_path/db_printlog -h $testdir \
101 error_check_good db_printlog $stat 0