1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996-2001
4
# Sleepycat Software. All rights reserved.
6
# $Id: recd004.tcl,v 11.26 2001/05/16 19:01:16 sue Exp $
9
# Verify that we work correctly when big keys get elevated.
10
proc recd004 { method {select 0} args} {
14
set opts [convert_args $method $args]
15
set omethod [convert_method $method]
17
set pgindex [lsearch -exact $args "-pagesize"]
18
if { $pgindex != -1 } {
19
puts "Recd004: skipping for specific pagesizes"
22
if { [is_record_based $method] == 1 } {
23
puts "Recd004 skipping for method $method"
26
puts "Recd004: $method big-key on internal page recovery tests"
28
berkdb srand $rand_init
31
set testfile recd004.db
32
set testfile2 recd004-2.db
33
set eflags "-create -txn -home $testdir"
34
puts "\tRecd004.a: creating environment"
35
set env_cmd "berkdb env $eflags"
36
set dbenv [eval $env_cmd]
37
error_check_bad dbenv $dbenv NULL
39
# Create the databases. We will use a small page size so that we
41
set oflags "-create -mode 0644 \
42
$omethod -env $dbenv $opts -pagesize 512 $testfile"
43
set db [eval {berkdb_open} $oflags]
44
error_check_bad db_open $db NULL
45
error_check_good db_open [is_substr $db db] 1
46
error_check_good db_close [$db close] 0
47
set oflags "-create -mode 0644 \
48
$omethod -env $dbenv $opts -pagesize 512 $testfile2"
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
55
# List of recovery tests: {CMD MSG} pairs
57
{ {big_populate DB TXNID $n} "Recd004.b: big key elevation"}
58
{ {unpopulate DB TXNID 0} "Recd004.c: Remove keys"}
61
# If pages are 512 bytes, then adding 512 key/data pairs
62
# should be more than sufficient.
65
set cmd [subst [lindex $pair 0]]
66
set msg [lindex $pair 1]
68
set tag [lindex $msg 0]
69
set tail [expr [string length $tag] - 2]
70
set tag [string range $tag $tail $tail]
71
if { [lsearch $select $tag] == -1 } {
75
op_recover abort $testdir $env_cmd $testfile $cmd $msg
76
op_recover commit $testdir $env_cmd $testfile $cmd $msg
78
# Note that since prepare-discard ultimately aborts
79
# the txn, it must come before prepare-commit.
81
op_recover prepare-abort $testdir $env_cmd $testfile2 \
83
op_recover prepare-discard $testdir $env_cmd $testfile2 \
85
op_recover prepare-commit $testdir $env_cmd $testfile2 \
89
puts "\tRecd004.d: Verify db_printlog can read logfile"
90
set tmpfile $testdir/printlog.out
91
set stat [catch {exec $util_path/db_printlog -h $testdir \
93
error_check_good db_printlog $stat 0