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

« back to all changes in this revision

Viewing changes to libdb/test/recd019.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  recd019
9
 
# TEST  Test txn id wrap-around and recovery.
10
 
proc recd019 { method {numid 50} args} {
11
 
        global fixed_len
12
 
        global txn_curid
13
 
        global log_log_record_types
14
 
        source ./include.tcl
15
 
 
16
 
        set orig_fixed_len $fixed_len
17
 
        set opts [convert_args $method $args]
18
 
        set omethod [convert_method $method]
19
 
 
20
 
        puts "Recd019: $method txn id wrap-around test"
21
 
 
22
 
        # Create the database and environment.
23
 
        env_cleanup $testdir
24
 
 
25
 
        set testfile recd019.db
26
 
 
27
 
        set flags "-create -txn -home $testdir"
28
 
 
29
 
        puts "\tRecd019.a: creating environment"
30
 
        set env_cmd "berkdb_env $flags"
31
 
        set dbenv [eval $env_cmd]
32
 
        error_check_good dbenv [is_valid_env $dbenv] TRUE
33
 
 
34
 
        # Test txn wrapping.  Force a txn_recycle msg.
35
 
        #
36
 
        set new_curid $txn_curid
37
 
        set new_maxid [expr $new_curid + $numid]
38
 
        error_check_good txn_id_set [$dbenv txn_id_set $new_curid $new_maxid] 0
39
 
 
40
 
        #
41
 
        # We need to create a database to get the pagesize (either
42
 
        # the default or whatever might have been specified).
43
 
        # Then remove it so we can compute fixed_len and create the
44
 
        # real database.
45
 
        set oflags "-create $omethod -mode 0644 \
46
 
            -env $dbenv $opts $testfile"
47
 
        set db [eval {berkdb_open} $oflags]
48
 
        error_check_good db_open [is_valid_db $db] TRUE
49
 
        set stat [$db stat]
50
 
        #
51
 
        # Compute the fixed_len based on the pagesize being used.
52
 
        # We want the fixed_len to be 1/4 the pagesize.
53
 
        #
54
 
        set pg [get_pagesize $stat]
55
 
        error_check_bad get_pagesize $pg -1
56
 
        set fixed_len [expr $pg / 4]
57
 
        error_check_good db_close [$db close] 0
58
 
        error_check_good dbremove [berkdb dbremove -env $dbenv $testfile] 0
59
 
 
60
 
        # Convert the args again because fixed_len is now real.
61
 
        # Create the databases and close the environment.
62
 
        # cannot specify db truncate in txn protected env!!!
63
 
        set opts [convert_args $method ""]
64
 
        set omethod [convert_method $method]
65
 
        set oflags "-create $omethod -mode 0644 \
66
 
            -env $dbenv -auto_commit $opts $testfile"
67
 
        set db [eval {berkdb_open} $oflags]
68
 
        error_check_good db_open [is_valid_db $db] TRUE
69
 
 
70
 
        #
71
 
        # Force txn ids to wrap twice and then some.
72
 
        #
73
 
        set nument [expr $numid * 3 - 2]
74
 
        puts "\tRecd019.b: Wrapping txn ids after $numid"
75
 
        set file $testdir/$testfile.init
76
 
        catch { file copy -force $testdir/$testfile $file} res
77
 
        copy_extent_file $testdir $testfile init
78
 
        for { set i 1 } { $i <= $nument } { incr i } {
79
 
                # Use 'i' as key so method doesn't matter
80
 
                set key $i
81
 
                set data $i
82
 
 
83
 
                # Put, in a txn.
84
 
                set txn [$dbenv txn]
85
 
                error_check_good txn_begin [is_valid_txn $txn $dbenv] TRUE
86
 
                error_check_good db_put \
87
 
                    [$db put -txn $txn $key [chop_data $method $data]] 0
88
 
                error_check_good txn_commit [$txn commit] 0
89
 
        }
90
 
        error_check_good db_close [$db close] 0
91
 
        set file $testdir/$testfile.afterop
92
 
        catch { file copy -force $testdir/$testfile $file} res
93
 
        copy_extent_file $testdir $testfile afterop
94
 
        error_check_good env_close [$dbenv close] 0
95
 
 
96
 
        # Keep track of the log types we've seen
97
 
        if { $log_log_record_types == 1} {
98
 
                logtrack_read $testdir
99
 
        }
100
 
 
101
 
        # Now, loop through and recover.
102
 
        puts "\tRecd019.c: Run recovery (no-op)"
103
 
        set ret [catch {exec $util_path/db_recover -h $testdir} r]
104
 
        error_check_good db_recover $ret 0
105
 
 
106
 
        puts "\tRecd019.d: Run recovery (initial file)"
107
 
        set file $testdir/$testfile.init
108
 
        catch { file copy -force $file $testdir/$testfile } res
109
 
        move_file_extent $testdir $testfile init copy
110
 
 
111
 
        set ret [catch {exec $util_path/db_recover -h $testdir} r]
112
 
        error_check_good db_recover $ret 0
113
 
 
114
 
        puts "\tRecd019.e: Run recovery (after file)"
115
 
        set file $testdir/$testfile.afterop
116
 
        catch { file copy -force $file $testdir/$testfile } res
117
 
        move_file_extent $testdir $testfile afterop copy
118
 
 
119
 
        set ret [catch {exec $util_path/db_recover -h $testdir} r]
120
 
        error_check_good db_recover $ret 0
121
 
}