1 /*-
2  * Copyright (c) 2011, 2020 Oracle and/or its affiliates.  All rights reserved.
3  *
4  * See the file LICENSE for license information.
5  */
6 
7 #include <pthread.h>
8 #include <db.h>
9 
10 /* Maximum number of db handles that init/close_xa_server will handle. */
11 #define MAX_NUMDB	4
12 
13 /* Names for the databases. */
14 static char *db_names[] = {"table1.db", "table2.db", "table3.db", "table4.db"};
15 
16 /* Debugging output. */
17 #ifdef VERBOSE
18 static int verbose = 1;
19 #else
20 static int verbose = 0;
21 #endif
22 
23 /* Table handles. */
24 DB *dbs[MAX_NUMDB];
25 
26 /*
27  * This function syncs all clients by having each one create
28  * a file called [num]_[test_num]_[call], and attempting to read the files
29  * the other clients create until it succeeds.
30  */
31 int sync_clients(int num, int num_clients, int call, int test_num);
32 
33 /*
34  * Print callback for __db_prdbt.
35  */
36 int pr_callback(void *handle, const void *str_arg);
37 /*
38  * Initialize an XA server and allocates and opens database handles.
39  * The number of database handles it opens is the value of the argument
40  *  num_db.
41  */
42 int init_xa_server(int num_db, const char *progname, int use_mvcc);
43 
44 /*
45  * Called when the servers are shutdown.  This closes all open
46  * database handles. num_db is the number of open database handles.
47  */
48 void close_xa_server(int num_db, const char *progname);
49 
50 /*
51  * check_data --
52  *	Compare data between two databases to ensure that they are identical.
53  */
54 int check_data(DB_ENV *dbenv1, const char *name1, DB_ENV *dbenv2,
55 	       const char *name2, const char *progname);
56