1# Copyright (c) 1996, 2020 Oracle and/or its affiliates. All rights reserved. 2# 3# See the file LICENSE for license information. 4# 5# $Id$ 6# 7# TEST test123 8# TEST Concurrent Data Store cdsgroup smoke test. 9# TEST 10# TEST Open a CDS env with -cdb_alldb. 11# TEST Start a "txn" with -cdsgroup. 12# TEST Create two databases in the env, do a cursor put 13# TEST in both within the same txn. This should succeed. 14 15proc test123 { method args } { 16 source ./include.tcl 17 18 # If we are using an env, then skip this test. It needs its own. 19 set eindex [lsearch -exact $args "-env"] 20 if { $eindex != -1 } { 21 incr eindex 22 set env [lindex $args $eindex] 23 puts "Skipping test123 for env $env" 24 return 25 } 26 27 # Heap and Queue don't support sub-databases. 28 if { [is_queue $method] == 1 || [is_heap $method] == 1} { 29 puts "Skipping test123 for method $method" 30 return 31 } 32 if { [is_partitioned $args] == 1 } { 33 puts "Test123 skipping for partitioned $method" 34 return 35 } 36 set args [convert_args $method $args] 37 set encargs "" 38 set args [split_encargs $args encargs] 39 set omethod [convert_method $method] 40 set pageargs "" 41 split_pageargs $args pageargs 42 set dbname test123.db 43 set tnum "123" 44 45 puts "Test$tnum: CDB with cdsgroup ($method)" 46 env_cleanup $testdir 47 48 # Open environment and start cdsgroup "transaction". 49 puts "\tTest$tnum.a: Open env." 50 set env [eval {berkdb_env -create} \ 51 $pageargs $encargs -cdb -cdb_alldb -home $testdir] 52 error_check_good dbenv [is_valid_env $env] TRUE 53 set txn [$env cdsgroup] 54 55 # Env is created, now set up 2 databases 56 puts "\tTest$tnum.b: Open first database." 57 set db1 [eval {berkdb_open}\ 58 -create -env $env $args $omethod -txn $txn $dbname "A"] 59 puts "\tTest$tnum.b1: Open cursor." 60 set curs1 [eval {$db1 cursor} -update -txn $txn] 61 puts "\tTest$tnum.b2: Initialize cursor and do a put." 62 error_check_good curs1_put [eval {$curs1 put} -keyfirst 1 DATA1] 0 63 64 puts "\tTest$tnum.c: Open second database." 65 set db2 [eval {berkdb_open}\ 66 -create -env $env $args $omethod -txn $txn $dbname "B"] 67 puts "\tTest$tnum.c1: Open cursor." 68 set curs2 [eval {$db2 cursor} -update -txn $txn] 69 puts "\tTest$tnum.b2: Initialize cursor and do a put." 70 error_check_good curs2_put [eval {$curs2 put} -keyfirst 2 DATA2] 0 71 72 # Clean up. 73 $curs2 close 74 $curs1 close 75 $txn commit 76 $db2 close 77 $db1 close 78 $env close 79 80} 81 82