proc sdb018 {method {nentries 100} args } {
source ./include.tcl
global rand_init
set args [convert_args $method $args]
set omethod [convert_method $method]
if { [is_record_based $method] == 1 || [is_rbtree $method] } {
puts "\tSubdb018 skipping for method $method."
return
}
set eindex [lsearch -exact $args "-env"]
if { $eindex != -1 } {
incr eindex
set env [lindex $args $eindex]
puts "Subdb016 skipping for env $env"
return
}
set chkindex [lsearch -exact $args "-chksum"]
if { $chkindex != -1 } {
set args [lreplace $args $chkindex $chkindex]
}
set testfile ""
berkdb srand $rand_init
foreach opt {" -dup" " -dupsort"} {
env_cleanup $testdir
set cache [expr 1024 * 1024 * 10]
set env [berkdb_env -create -home $testdir \
-cachesize "0 $cache 1" ]
append args $opt
set oargs $args
append oargs " -env $env"
puts "Subdb018: $method ( $args ) Intra-subdb join"
set txn ""
puts "\tSubdb018.a: Intra-subdb join"
set psize 8192
set duplist {0 50 25 16 12}
set numdb [llength $duplist]
build_all_subdb $testfile [list $method] $psize \
$duplist $nentries $oargs
puts "Subdb018: Building the primary database $method"
set oflags "-create -mode 0644 [conv $omethod \
[berkdb random_int 1 2]]"
set db [eval {berkdb_open} $oflags $oargs {$testfile} primary.db]
error_check_good dbopen [is_valid_db $db] TRUE
for { set i 0 } { $i < 1000 } { incr i } {
set key [format "%04d" $i]
set ret [eval {$db put} $txn {$key stub}]
error_check_good "primary put" $ret 0
}
error_check_good "primary close" [$db close] 0
set did [open $dict]
gets $did str
do_join_subdb $testfile primary.db "1 0" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "2 0" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 0" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 0" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "2" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "1 2" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "1 2 3" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "1 2 3 4" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "2 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 2 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 3 2 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "1 3" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "1 4" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "2 3" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 2" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "2 4" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 2" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 4" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 3" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "2 3 4" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 4 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 2 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "0 2 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "3 2 0" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 3 2 1" $str $oargs
gets $did str
do_join_subdb $testfile primary.db "4 3 0 1" $str $oargs
close $did
error_check_good env_close [$env close] 0
}
}