~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/test/log005.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# See the file LICENSE for redistribution information.
2
 
#
3
 
# Copyright (c) 1996-2002
4
 
#       Sleepycat Software.  All rights reserved.
5
 
#
6
 
# $Id$
7
 
#
8
 
# TEST  log005
9
 
# TEST  Check that log file sizes can change on the fly.
10
 
proc log005 { } {
11
 
        source ./include.tcl
12
 
 
13
 
        puts "Log005: Check that log file sizes can change."
14
 
        env_cleanup $testdir
15
 
 
16
 
        # Open the environment, set and check the log file size.
17
 
        puts "\tLog005.a: open, set and check the log file size."
18
 
        set env [berkdb_env \
19
 
            -create -home $testdir -log_buffer 10000 -log_max 1000000 -txn]
20
 
        error_check_good envopen [is_valid_env $env] TRUE
21
 
        set db [berkdb_open \
22
 
            -env $env -create -mode 0644 -btree -auto_commit a.db]
23
 
        error_check_good dbopen [is_valid_db $db] TRUE
24
 
 
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
28
 
 
29
 
        # Reset the log file size using a second open, and make sure
30
 
        # it changes.
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
35
 
 
36
 
        set tmp [log005_stat $env "Current log file size"]
37
 
        error_check_good max_changed 900000 $tmp
38
 
 
39
 
        puts "\tLog005.c: fill in the current log file size."
40
 
        # Fill in the current log file.
41
 
        set new_lsn 0
42
 
        set data [repeat "a" 1024]
43
 
        for { set i 1 } \
44
 
            { [log005_stat $env "Current log file number"] != 2 } \
45
 
            { incr i } {
46
 
                set t [$env txn]
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
51
 
 
52
 
                set last_lsn $new_lsn
53
 
                set new_lsn [log005_stat $env "Current log file offset"]
54
 
        }
55
 
 
56
 
        # The last LSN in the first file should be more than our new
57
 
        # file size.
58
 
        error_check_good "lsn check < 900000" [expr 900000 < $last_lsn] 1
59
 
 
60
 
        # Close down the environment.
61
 
        error_check_good db_close [$db close] 0
62
 
        error_check_good env_close [$env close] 0
63
 
 
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
66
 
        # left it.
67
 
        set env [berkdb_env -create -home $testdir -recover -txn]
68
 
        error_check_good env_open [is_valid_env $env] TRUE
69
 
 
70
 
        set tmp [log005_stat $env "Current log file size"]
71
 
        error_check_good after_recovery 900000 $tmp
72
 
 
73
 
        error_check_good env_close [$env close] 0
74
 
}
75
 
 
76
 
# log005_stat --
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} {
84
 
                        return $statval
85
 
                }
86
 
        }
87
 
        puts "FAIL: log005: stat string $s not found"
88
 
        return 0
89
 
}