1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996-2002
4
# Sleepycat Software. All rights reserved.
10
# TEST Same test as dead002, but explicitly specify DB_LOCK_OLDEST and
11
# TEST DB_LOCK_YOUNGEST. Verify the correct lock was aborted/granted.
12
proc dead003 { { procs "2 4 10" } {tests "ring clump" } } {
17
set detects { oldest youngest }
18
puts "Dead003: Deadlock detector tests: $detects"
20
# Create the environment.
23
puts "\tDead003.a: creating environment for $d"
25
-create -mode 0644 -home $testdir -lock -lock_detect $d]
26
error_check_good lock_env:open [is_valid_env $env] TRUE
32
set ret [$env lock_id_set \
33
$lock_curid $lock_maxid]
34
error_check_good lock_id_set $ret 0
37
puts "\tDead003: $n procs of test $t"
38
for { set i 0 } { $i < $n } { incr i } {
39
set locker [$env lock_id]
41
test_path/ddscript.tcl $testdir \
43
$testdir/dead003.log.$i"
44
set p [exec $tclsh_path \
47
$testdir/dead003.log.$i $testdir \
51
watch_procs $pidlist 5
57
for { set i 0 } { $i < $n } { incr i } {
58
set did [open $testdir/dead003.log.$i]
59
while { [gets $did val] != -1 } {
61
DEADLOCK { incr dead }
63
default { incr other }
68
dead_check $t $n 0 $dead $clean $other
70
# If we get here we know we have the
71
# correct number of dead/clean procs, as
72
# checked by dead_check above. Now verify
73
# that the right process was the one.
74
puts "\tDead003: Verify $d locks were aborted"
76
if { $d == "oldest" } {
79
if { $d == "youngest" } {
82
set did [open $testdir/dead003.log.$l]
83
while { [gets $did val] != -1 } {
84
error_check_good check_abort \
91
fileremove -f $testdir/dd.out
93
for { set i 0 } { $i < $n } { incr i } {
94
fileremove -f $testdir/dead003.log.$i
96
error_check_good lock_env:close [$env close] 0