1 # See the file LICENSE for redistribution information.
3 # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
8 #TEST Test of DB_TXN_WRITE_NOSYNC
9 proc txn007 { { iter 50 } } {
11 set testfile txn007.db
13 puts "Txn007: DB_TXN_WRITE_NOSYNC"
16 # Open/create the txn region
17 puts "\tTxn007.a: Create env and database with -wrnosync"
18 set e [berkdb_env -create -home $testdir -txn -wrnosync]
19 error_check_good env_open [is_valid_env $e] TRUE
21 # Open/create database
22 set db [berkdb open -auto_commit -env $e \
23 -create -btree -dup $testfile]
24 error_check_good db_open [is_valid_db $db] TRUE
27 puts "\tTxn007.b: Put $iter data items in individual transactions"
28 for { set i 1 } { $i < $iter } { incr i } {
31 error_check_good txn [is_valid_txn $txn $e] TRUE
32 $db put -txn $txn key$i data$i
33 error_check_good txn_commit [$txn commit] 0
35 set stat [$e log_stat]
36 puts "\tTxn007.c: Check log stats"
39 if { [string equal $txt {Times log written}] == 1 } {
40 set wrval [lindex $i 1]
42 if { [string equal $txt {Times log flushed to disk}] == 1 } {
43 set syncval [lindex $i 1]
46 error_check_good wrval [expr $wrval >= $iter] 1
48 # We should have written at least 'iter' number of times,
49 # but not synced on any of those.
51 set val [expr $wrval - $iter]
52 error_check_good syncval [expr $syncval <= $val] 1
54 error_check_good db_close [$db close] 0
55 error_check_good env_close [$e close] 0