1# See the file LICENSE for redistribution information. 2# 3# Copyright (c) 1996,2008 Oracle. All rights reserved. 4# 5# $Id: txn004.tcl,v 12.6 2008/01/08 20:58:53 bostic Exp $ 6# 7# TEST txn004 8# TEST Test of wraparound txnids (txn001) 9proc txn004 { } { 10 source ./include.tcl 11 global txn_curid 12 global txn_maxid 13 14 set orig_curid $txn_curid 15 set orig_maxid $txn_maxid 16 puts "\tTxn004.1: wraparound txnids" 17 set txn_curid [expr $txn_maxid - 2] 18 txn001 "004.1" 19 puts "\tTxn004.2: closer wraparound txnids" 20 set txn_curid [expr $txn_maxid - 3] 21 set txn_maxid [expr $txn_maxid - 2] 22 txn001 "004.2" 23 24 puts "\tTxn004.3: test wraparound txnids" 25 txn_idwrap_check $testdir 26 set txn_curid $orig_curid 27 set txn_maxid $orig_maxid 28 return 29} 30 31proc txn_idwrap_check { testdir } { 32 global txn_curid 33 global txn_maxid 34 35 env_cleanup $testdir 36 37 # Open/create the txn region 38 set e [berkdb_env -create -txn -home $testdir] 39 error_check_good env_open [is_substr $e env] 1 40 41 set txn1 [$e txn] 42 error_check_good txn1 [is_valid_txn $txn1 $e] TRUE 43 error_check_good txn_id_set \ 44 [$e txn_id_set [expr $txn_maxid - 1] $txn_maxid] 0 45 46 set txn2 [$e txn] 47 error_check_good txn2 [is_valid_txn $txn2 $e] TRUE 48 49 # txn3 will require a wraparound txnid 50 # XXX How can we test it has a wrapped id? 51 set txn3 [$e txn] 52 error_check_good wrap_txn3 [is_valid_txn $txn3 $e] TRUE 53 54 error_check_good free_txn1 [$txn1 commit] 0 55 error_check_good free_txn2 [$txn2 commit] 0 56 error_check_good free_txn3 [$txn3 commit] 0 57 58 error_check_good close [$e close] 0 59} 60 61