1# See the file LICENSE for redistribution information. 2# 3# Copyright (c) 1996,2008 Oracle. All rights reserved. 4# 5# $Id: log004.tcl,v 12.6 2008/01/08 20:58:53 bostic Exp $ 6# 7 8# TEST log004 9# TEST Make sure that if we do PREVs on a log, but the beginning of the 10# TEST log has been truncated, we do the right thing. 11proc log004 { } { 12 foreach inmem { 1 0 } { 13 log004_body $inmem 14 } 15} 16 17proc log004_body { inmem } { 18 source ./include.tcl 19 20 puts "Log004: Prev on log when beginning of log has been truncated." 21 # Use archive test to populate log 22 env_cleanup $testdir 23 puts "\tLog004.a: Call archive to populate log." 24 archive $inmem 25 26 # Delete all log files under 100 27 puts "\tLog004.b: Delete all log files under 100." 28 set ret [catch { glob $testdir/log.00000000* } result] 29 if { $ret == 0 } { 30 eval fileremove -f $result 31 } 32 33 # Now open the log and get the first record and try a prev 34 puts "\tLog004.c: Open truncated log, attempt to access missing portion." 35 set env [berkdb_env -create -log -home $testdir] 36 error_check_good envopen [is_valid_env $env] TRUE 37 38 set logc [$env log_cursor] 39 error_check_good log_cursor [is_valid_logc $logc $env] TRUE 40 41 set ret [$logc get -first] 42 error_check_bad log_get [llength $ret] 0 43 44 # This should give DB_NOTFOUND which is a ret of length 0 45 catch {$logc get -prev} ret 46 error_check_good log_get_prev [string length $ret] 0 47 48 puts "\tLog004.d: Close log and environment." 49 error_check_good log_cursor_close [$logc close] 0 50 error_check_good log_close [$env close] 0 51} 52