Thread: Does Replication Manager support 'Master Lease' ?

This question is not answered. Helpful answers available: 5. Correct answers available: 1.


Permlink Replies: 6 - Pages: 1 - Last Post: Oct 1, 2008 2:22 PM Last Post By: Alan.Bram
user572001

Posts: 1
Registered: 04/28/07
Does Replication Manager support 'Master Lease' ?
Posted: Sep 18, 2008 10:36 PM
 
Click to report abuse...   Click to reply to this thread Reply
Hello all,
I am using BDB 4.7.25 on a Linux 2.6.x environment.
Now I try to use 'Master Lease', the following settings were added to DB_CONFIG.

DB_CONFIG
rep_set_config db_rep_conf_lease
rep_set_timeout db_rep_lease_timeout 5000000
rep_set_clockskew 102 100

And execute example rep_mgr, error occurred.
(1 Master 2 Client, nsites set 3)

ex_rep: DB_ENV->rep_elect: nsites must be zero if leases configured
ex_rep: unexpected election failure: Invalid argument
ex_rep: election thread failed: Invalid argument
ex_rep: PANIC: Invalid argument

Besides, are some settings necessary?
sloverso

Posts: 90
Registered: 07/24/06
Re: Does Replication Manager support 'Master Lease' ?
Posted: Sep 19, 2008 7:49 AM   in response to: user572001 in response to: user572001
 
Click to report abuse...   Click to reply to this thread Reply
It looks like you are configuring things correctly and this may be
a bug in the interaction between repmgr and leases. I will
investigate that and followup.

Sue LoVerso
Oracle
damm

Posts: 17
Registered: 09/08/08
Re: Does Replication Manager support 'Master Lease' ?
Posted: Sep 26, 2008 10:26 PM   in response to: sloverso in response to: sloverso
 
Click to report abuse...   Click to reply to this thread Reply
I also meet this problem. After browsing the source code, I find this problem is in function __rep_elect. __rep_elect will be called with parameter "given_nsites" greater than 0(it is always true). However in __rep_elect, there are some checking code:
/* Error checking. */
if (IS_USING_LEASES(env) && given_nsites != 0) {
__db_errx(env,
"DB_ENV->rep_elect: nsites must be zero if leases configured");
return (EINVAL);
}

Thus election thread will fail, and a panic will happen.

I'm curious about the checking above. It is a little strange.
Alan.Bram

Posts: 369
Registered: 07/24/06
Re: Does Replication Manager support 'Master Lease' ?
Posted: Sep 27, 2008 4:00 PM   in response to: damm in response to: damm
 
Click to report abuse...   Click to reply to this thread Reply
This is a bug. I will post a patch shortly.

Alan Bram
Oracle
Alan.Bram

Posts: 369
Registered: 07/24/06
Re: Does Replication Manager support 'Master Lease' ?
Posted: Sep 28, 2008 5:30 PM   in response to: Alan.Bram in response to: Alan.Bram
 
Click to report abuse...   Click to reply to this thread Reply
Here is an experimental patch which should fix this problem.

diff -r 2089d019de8b repmgr/repmgr_elect.c
--- a/repmgr/repmgr_elect.c	Mon Sep 08 16:07:04 2008 +0000
+++ b/repmgr/repmgr_elect.c	Sun Sep 28 17:09:57 2008 -0700
@@ -188,7 +188,8 @@ __repmgr_elect_main(env)
 		    (env, "elect thread to do: %d", to_do));
 		switch (to_do) {
 		case ELECT_ELECTION:
-			nsites = __repmgr_get_nsites(db_rep);
+			nsites = IS_USING_LEASES(env) ?
+			    0 : __repmgr_get_nsites(db_rep);
 			/*
 			 * With only 2 sites in the group, even a single failure
 			 * could make it impossible to get a majority.  So,
damm

Posts: 17
Registered: 09/08/08
Re: Does Replication Manager support 'Master Lease' ?
Posted: Sep 30, 2008 11:08 PM   in response to: Alan.Bram in response to: Alan.Bram
 
Click to report abuse...   Click to reply to this thread Reply
Thanks. However the patch still has a problem: you need to set nvotes to 0. Otherwise nvoites will be 1, and when __rep_elect is called, ack will be 1 too which is actually incorrect.

BTW, how to insert a chunk of code into the message?
Alan.Bram

Posts: 369
Registered: 07/24/06
Re: Does Replication Manager support 'Master Lease' ?
Posted: Oct 1, 2008 2:22 PM   in response to: damm in response to: damm
 
Click to report abuse...   Click to reply to this thread Reply
You're right; that previous patch is defective. However, I think it still makes sense to use a non-zero nvotes.

I've worked up a new version of the fix. But now in testing it some other issues have cropped up. I'll continue working on those, and post the new patch as soon as possible.

Alan Bram
Oracle
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums