Release 4.2: Replication

Replication initialization
Database methods and replication clients
DB_ENV->rep_process_message()

Replication initialization

In the Berkeley DB 4.2 release, replication environments must be specifically initialized by any process that will ever do anything other than open databases in read-only mode (that is, any process which might call any of the Berkeley DB replication interfaces or modify databases). This initialization is done when the replication database environment handle is opened, by specifying the DB_INIT_REP flag to the DB_ENV->open() method.

Database methods and replication clients

All of the DB object methods may now return DB_REP_HANDLE_DEAD when a replication client changes masters. When this happens the DB handle is no longer able to be used and the application must close the handle using the DB->close() method and open a new handle. This new return value is returned when a client unrolls a transaction in order to synchronize with the new master. Otherwise, if the application was permitted to use the original handle, it's possible the handle might attempt to access nonexistent resources.

The DB_ENV->rep_process_message() method has new return values and an log sequence number (LSN) associated with those return values. The new argument is ret_lsnp, which is the returned LSN when the DB_ENV->rep_process_message() method returns DB_REP_ISPERM or DB_REP_NOTPERM. See Transactional guarantees for more information.