1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996-2002
4
# Sleepycat Software. All rights reserved.
9
# TEST Check that log file sizes can change on the fly.
13
puts "Log005: Check that log file sizes can change."
16
# Open the environment, set and check the log file size.
17
puts "\tLog005.a: open, set and check the log file size."
19
-create -home $testdir -log_buffer 10000 -log_max 1000000 -txn]
20
error_check_good envopen [is_valid_env $env] TRUE
22
-env $env -create -mode 0644 -btree -auto_commit a.db]
23
error_check_good dbopen [is_valid_db $db] TRUE
25
# Get the current log file maximum.
26
set max [log005_stat $env "Current log file size"]
27
error_check_good max_set $max 1000000
29
# Reset the log file size using a second open, and make sure
31
puts "\tLog005.b: reset during open, check the log file size."
32
set envtmp [berkdb_env -home $testdir -log_max 900000 -txn]
33
error_check_good envtmp_open [is_valid_env $envtmp] TRUE
34
error_check_good envtmp_close [$envtmp close] 0
36
set tmp [log005_stat $env "Current log file size"]
37
error_check_good max_changed 900000 $tmp
39
puts "\tLog005.c: fill in the current log file size."
40
# Fill in the current log file.
42
set data [repeat "a" 1024]
44
{ [log005_stat $env "Current log file number"] != 2 } \
47
error_check_good txn [is_valid_txn $t $env] TRUE
48
set ret [$db put -txn $t $i $data]
49
error_check_good put $ret 0
50
error_check_good txn [$t commit] 0
53
set new_lsn [log005_stat $env "Current log file offset"]
56
# The last LSN in the first file should be more than our new
58
error_check_good "lsn check < 900000" [expr 900000 < $last_lsn] 1
60
# Close down the environment.
61
error_check_good db_close [$db close] 0
62
error_check_good env_close [$env close] 0
64
puts "\tLog005.d: check the log file size is unchanged after recovery."
65
# Open again, running recovery. Verify the log file size is as we
67
set env [berkdb_env -create -home $testdir -recover -txn]
68
error_check_good env_open [is_valid_env $env] TRUE
70
set tmp [log005_stat $env "Current log file size"]
71
error_check_good after_recovery 900000 $tmp
73
error_check_good env_close [$env close] 0
77
# Return the current log statistics.
78
proc log005_stat { env s } {
79
set stat [$env log_stat]
80
foreach statpair $stat {
81
set statmsg [lindex $statpair 0]
82
set statval [lindex $statpair 1]
83
if {[is_substr $statmsg $s] != 0} {
87
puts "FAIL: log005: stat string $s not found"