1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1999-2002
4
# Sleepycat Software. All rights reserved.
9
# TEST Tests page size difference errors between subdbs.
10
# TEST Test 3 different scenarios for page sizes.
11
# TEST 1. Create/open with a default page size, 2nd subdb create with
12
# TEST specified different one, should error.
13
# TEST 2. Create/open with specific page size, 2nd subdb create with
14
# TEST different one, should error.
15
# TEST 3. Create/open with specified page size, 2nd subdb create with
16
# TEST same specified size, should succeed.
17
# TEST (4th combo of using all defaults is a basic test, done elsewhere)
18
proc subdb007 { method args } {
21
set db2args [convert_args -btree $args]
22
set args [convert_args $method $args]
23
set omethod [convert_method $method]
25
if { [is_queue $method] == 1 } {
26
puts "Subdb007: skipping for method $method"
29
set pgindex [lsearch -exact $args "-pagesize"]
30
if { $pgindex != -1 } {
31
puts "Subdb007: skipping for specific page sizes"
35
puts "Subdb007: $method ($args) subdb tests with different page sizes"
39
set eindex [lsearch -exact $args "-env"]
41
# If we are using an env, then testfile should just be the db name.
42
# Otherwise it is the test directory and the name.
43
if { $eindex == -1 } {
44
set testfile $testdir/subdb007.db
47
set testfile subdb007.db
49
set env [lindex $args $eindex]
50
set envargs " -env $env "
51
set txnenv [is_txnenv $env]
53
append args " -auto_commit "
54
append envargs " -auto_commit "
55
append db2args " -auto_commit "
57
set testdir [get_home $env]
64
puts "\tSubdb007.a.0: create subdb with default page size"
65
set db [eval {berkdb_open -create -mode 0644} \
66
$args {$omethod $testfile $sub1}]
67
error_check_good subdb [is_valid_db $db] TRUE
69
# Figure out what the default page size is so that we can
70
# guarantee we create it with a different value.
71
set statret [$db stat]
73
foreach pair $statret {
74
set fld [lindex $pair 0]
75
if { [string compare $fld {Page size}] == 0 } {
76
set pgsz [lindex $pair 1]
79
error_check_good dbclose [$db close] 0
87
puts "\tSubdb007.a.1: create 2nd subdb with specified page size"
88
set stat [catch {eval {berkdb_open_noerr -create -btree} \
89
$db2args {-pagesize $pgsz2 $testfile $sub2}} ret]
90
error_check_good subdb:pgsz $stat 1
91
error_check_good subdb:fail [is_substr $ret \
92
"Different pagesize specified"] 1
94
set ret [eval {berkdb dbremove} $envargs {$testfile}]
96
puts "\tSubdb007.b.0: create subdb with specified page size"
97
set db [eval {berkdb_open -create -mode 0644} \
98
$args {-pagesize $pgsz2 $omethod $testfile $sub1}]
99
error_check_good subdb [is_valid_db $db] TRUE
100
set statret [$db stat]
102
foreach pair $statret {
103
set fld [lindex $pair 0]
104
if { [string compare $fld {Page size}] == 0 } {
105
set newpgsz [lindex $pair 1]
108
error_check_good pgsize $pgsz2 $newpgsz
109
error_check_good dbclose [$db close] 0
111
puts "\tSubdb007.b.1: create 2nd subdb with different page size"
112
set stat [catch {eval {berkdb_open_noerr -create -btree} \
113
$db2args {-pagesize $pgsz $testfile $sub2}} ret]
114
error_check_good subdb:pgsz $stat 1
115
error_check_good subdb:fail [is_substr $ret \
116
"Different pagesize specified"] 1
118
set ret [eval {berkdb dbremove} $envargs {$testfile}]
120
puts "\tSubdb007.c.0: create subdb with specified page size"
121
set db [eval {berkdb_open -create -mode 0644} \
122
$args {-pagesize $pgsz2 $omethod $testfile $sub1}]
123
error_check_good subdb [is_valid_db $db] TRUE
124
error_check_good dbclose [$db close] 0
126
puts "\tSubdb007.c.1: create 2nd subdb with same specified page size"
127
set db [eval {berkdb_open -create -mode 0644} \
128
$args {-pagesize $pgsz2 $omethod $testfile $sub2}]
129
error_check_good subdb [is_valid_db $db] TRUE
130
error_check_good dbclose [$db close] 0