###

Berkeley DB Reference Guide:
  Berkeley DB Replication

# Connecting to a new site

Connecting to a new site in the replication group happens whenever the DB_ENV->rep_process_message method returns DB_REP_NEWSITE. The application should assign the new site a local environment ID number, and all future messages from the site passed to DB_ENV->rep_process_message should include that environment ID number. It is possible, of course, for the application to be aware of a new site before the return of DB_ENV->rep_process_message (for example, applications using connection-oriented protocols are likely to detect new sites immediately, while applications using broadcast protocols may not).

Regardless, in applications supporting the dynamic addition of database environments to replication groups, environments joining an existing replication group may need to provide contact information. (For example, in an application using TCP/IP sockets, a DNS name or IP address might be a reasonable value to provide.) This can be done using the cdata parameter to the DB_ENV->rep_start method. The information referenced by cdata is wrapped in the initial contact message sent by the new environment, and is provided to the existing members of the group using the rec parameter returned by DB_ENV->rep_process_message. If no additional information was provided for Berkeley DB to forward to the existing members of the group, the data field of the rec parameter passed to the DB_ENV->rep_process_message method will be NULL after DB_ENV->rep_process_message returns DB_REP_NEWSITE.

Copyright Sleepycat Software