summaryrefslogtreecommitdiff
path: root/examples/c/ex_rep/mgr
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-02-17 17:25:57 +0000
committer <>2015-03-17 16:26:24 +0000
commit780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch)
tree598f8b9fa431b228d29897e798de4ac0c1d3d970 /examples/c/ex_rep/mgr
parent7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff)
downloadberkeleydb-master.tar.gz
Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz.HEADdb-6.1.23master
Diffstat (limited to 'examples/c/ex_rep/mgr')
-rw-r--r--examples/c/ex_rep/mgr/rep_mgr.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/examples/c/ex_rep/mgr/rep_mgr.c b/examples/c/ex_rep/mgr/rep_mgr.c
index 0eaf1971..5c6d15f5 100644
--- a/examples/c/ex_rep/mgr/rep_mgr.c
+++ b/examples/c/ex_rep/mgr/rep_mgr.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -115,6 +115,10 @@ main(argc, argv)
dbenv->err(dbenv, ret,
"Could not set heartbeat monitor timeout.\n");
+ /* Create thread-specific data key for PERM_FAILED structure. */
+ if ((ret = thread_key_create(&permfail_key)) != 0)
+ goto err;
+
/*
* The following repmgr features may also be useful to your
* application. See Berkeley DB documentation for more details.
@@ -133,6 +137,7 @@ main(argc, argv)
/* Start checkpoint and log archive threads. */
sup_args.dbenv = dbenv;
sup_args.shared = &my_app_data.shared_data;
+ my_app_data.shared_data.is_repmgr = 1;
if ((ret = start_support_threads(dbenv, &sup_args, &ckp_thr,
&lga_thr)) != 0)
goto err;
@@ -163,6 +168,10 @@ main(argc, argv)
goto err;
}
+ /* Delete thread-specific data key for PERM_FAILED structure. */
+ if ((ret = thread_key_delete(permfail_key)) != 0)
+ goto err;
+
err:
if (dbenv != NULL &&
(t_ret = dbenv->close(dbenv, 0)) != 0) {
@@ -183,8 +192,10 @@ event_callback(dbenv, which, info)
{
APP_DATA *app = dbenv->app_private;
SHARED_DATA *shared = &app->shared_data;
+ permfail_t *pfinfo;
int err;
+ pfinfo = NULL;
switch (which) {
case DB_EVENT_PANIC:
@@ -213,8 +224,12 @@ event_callback(dbenv, which, info)
* transaction will be flushed to the master site's
* local disk storage for durability.
*/
+ /* Set this thread's PERM_FAILED indicator. */
+ pfinfo = (permfail_t *)thread_getspecific(permfail_key);
+ printf("%s Thread: ", pfinfo->thread_name);
+ pfinfo->flag = 1;
printf(
- "Insufficient acknowledgements to guarantee transaction durability.\n");
+ "Insufficient acknowledgements for transaction durability.\n");
break;
case DB_EVENT_REP_STARTUPDONE: