[pybsddb] Replication setup reliably ending in DB_EVENT_PANIC

Omri Schwarz ocschwar at MIT.EDU
Wed May 11 15:03:51 CEST 2011


Hi, all.

I have a simple application written in Python. It has a DB master
with various duties, and a DB client with other duties entirely, and
so they run out of different files.

The database thread in the master starts things as follows:

         self.env = BSDdb.DBEnv()
         flags =( BSDdb.DB_CREATE|
                  BSDdb.DB_RECOVER|
                  BSDdb.DB_INIT_REP|
                  BSDdb.DB_THREAD|
                  BSDdb.DB_INIT_MPOOL|
                  BSDdb.DB_INIT_LOG|
                  BSDdb.DB_INIT_LOCK|
                  BSDdb.DB_INIT_TXN)
         self.env.open(DIR,
                       flags)
         if self.mode == 'rep' :
             self.env.repmgr_set_local_site("0.0.0.0",
                                            RT_PARAMS.PMS_REPL_PORT)
             self.env.repmgr_set_ack_policy(BSDdb.DB_REPMGR_ACKS_NONE)
             self.env.rep_set_timeout(BSDdb.DB_REP_HEARTBEAT_SEND,20000000)
             self.env.repmgr_start(4,BSDdb.DB_REP_MASTER)

On the client side I have this:

def log_event(a,b,c):
     #lg.info('a %s %s'%(a,dir(a)))
     #lg.info('b %s'%b)
     #lg.info('c %s'%c)
     print a,b,c


def init_rep_env(dir,host,port,lg):
     E = bsddb3.db.DBEnv()
     E.open(dir,
            bsddb3.db.DB_CREATE|
            bsddb3.db.DB_RECOVER|
            bsddb3.db.DB_INIT_LOCK|
            bsddb3.db.DB_INIT_LOG|
            bsddb3.db.DB_INIT_MPOOL|
            bsddb3.db.DB_INIT_TXN|
            bsddb3.db.DB_THREAD|
            bsddb3.db.DB_INIT_REP)
     lg.info('Opened environment')
     other_host=host
     other_port=port
     listen_host='localhost'
     listenport=22223
     E.repmgr_set_local_site(listen_host,listenport,0)
     E.repmgr_add_remote_site(other_host,other_port,0)
     E.set_event_notify(log_event)
     ret = E.repmgr_start(8,bsddb3.db.DB_REP_CLIENT)
     lg.info('syncrting %s'%(ret,))
     return E

When I connect the client from another host, the following happens:
I get bsddb3.db.DB_EVENT_REP_CLIENT, then 
bsddb3.db.DB_EVENT_REP_NEWMASTER, and the databases all copy to the client
directory, and then I get DB_EVENT_PANIC and can't use the environment for 
anything.

When I run this sequence on the same host, however, I get STARTUP_DONE
and things appear to work. What in the world am I doing wrong? I'm 
guessing my DB master is not putting the right details into 
E.repmgr_set_local_site(). What should I be putting in?

Thanks, all.


Omri Schwarz --- ocschwar at mit.edu
Timeless wisdom of biomedical engineering: "Noise is principally
due to the presence of the patient." -- R.F. Farr



More information about the pybsddb mailing list