summaryrefslogtreecommitdiff
path: root/test/xa/utilities/bdb_xa_util.h
blob: 2f9601436758a39340ebd16827b92820daade7bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2011, 2012 Oracle and/or its affiliates.  All rights reserved.
 */

#include <pthread.h>
#include <db.h>

/* Maximum number of db handles that init/close_xa_server will handle. */
#define MAX_NUMDB	4

/* Names for the databases. */
static char *db_names[] = {"table1.db", "table2.db", "table3.db", "table4.db"};

/* Debugging output. */
#ifdef VERBOSE
static int verbose = 1;				
#else
static int verbose = 0;
#endif

/* Table handles. */				
DB *dbs[MAX_NUMDB]; 

/*
 * This function syncs all threads threads by putting them to
 * sleep until the last thread enters and sync function and
 * forces the rest to wake up.
 * counter - A counter starting at 0 shared by all threads
 * num_threads - the number of threads being synced.
 */
int sync_thr(int *counter, int num_threads, pthread_cond_t *cond_var);

/*
 * Print callback for __db_prdbt.
 */
int pr_callback(void *handle, const void *str_arg);
/*
 * Initialize an XA server and allocates and opens database handles.  
 * The number of database handles it opens is the value of the argument
 *  num_db.
 */
int init_xa_server(int num_db, const char *progname, int use_mvcc);

/* 
 * Called when the servers are shutdown.  This closes all open 
 * database handles. num_db is the number of open database handles.
 */
void close_xa_server(int num_db, const char *progname);

/*
 * check_data --
 *	Compare data between two databases to ensure that they are identical.
 */
int check_data(DB_ENV *dbenv1, const char *name1, DB_ENV *dbenv2, 
	       const char *name2, const char *progname);