[pybsddb] bdb replica node problem

Yingbo Qiu qiuyingbo at gmail.com
Thu May 29 03:02:21 CEST 2008


I just want a Master-Slave mode to balance read performance.
so I set replica node's priority to 0 and open db with DB_RDONLY flag.
But if I directly open db after repmgr_start, it may report DeadLock
status, or open db without any error but follow read operation will raise
RUNRECOVERY error.

my code:
.... init env ...
dbenv.rep_set_priority(0)
dbenv.repmgr_add_remote_site(master_host, master_port)
dbenv.repmgr_start(3, DB_REP_CLIENT)

for dbfile in mydbfilelist:
    db = DB(dbenv)
    db.open(dbfile, dbtype=DB_HASH, flags = DB_RDONLY)
....

Why?

Now I put the db open operation in DB_EVENT_REP_STARTUPDONE
event callback function, and it seem ok. But bdb manual say
that isn't reliable.
http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_event_notify.html

How do you think about my problem??



More information about the pybsddb mailing list