1# Copyright (c) 2013, 2020 Oracle and/or its affiliates.  All rights reserved.
2#
3# See the file LICENSE for license information.
4#
5# $Id$
6#
7# Multiple process mpool filler.
8
9source ./include.tcl
10source $test_path/test.tcl
11source $test_path/testutils.tcl
12
13puts "Memp008: Sub-test for MPOOL filling."
14set targetenv [berkdb_env -home $testdir]
15
16# Use a marker file to tell child processes when to stop.
17set stop_fname "$testdir/memp008.stop"
18error_check_good chkfile [file exists $stop_fname] 0
19
20set db [eval {berkdb_open -env $targetenv -auto_commit "memp008.db"} ]
21error_check_good dbopen [is_valid_db $db] TRUE
22
23for { set key 0} { $key < 1000 } { incr key } {
24	set ret [catch {$db put $key $key} result]
25	if { $ret == 1 } {
26		puts "$key: $result"
27		# The MPOOL might be filled by data.
28		if {![is_substr $result "not enough memory"] &&\
29		    ![is_substr $result "unable to allocate"] } {
30			puts "FAIL: in filling DB, $result"
31		}
32		break
33	}
34}
35
36puts "Memp008: Create stop flag file."
37set fileid [open $stop_fname "w"]
38error_check_good createfile [close $fileid] ""
39
40error_check_good db_close [$db close] 0
41
42puts "Memp008: Sub-test for MPOOL filling finished."
43