head 1.2; access; symbols RPM_4_2_1:1.1.1.4 RPM_4_2:1.1.1.4 RPM_4_1_1:1.1.1.4 RPM_4_1:1.1.1.3 RPM_4_0_5:1.1.1.2 RPM_4_0_4:1.1.1.1 RPM:1.1.1; locks; strict; comment @# @; 1.2 date 2008.01.02.09.55.29; author rse; state dead; branches; next 1.1; commitid z4cpSiAhOCXk5PLs; 1.1 date 2002.01.08.00.30.12; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2002.01.08.00.30.12; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2003.01.18.13.49.03; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2002.01.17.20.11.42; author rse; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2003.01.18.14.05.00; author rse; state Exp; branches; next ; desc @@ 1.2 log @remove the ancient RPM 4.2.1 source tree copy @ text @
|
![]() ![]() ![]() |
The simplest way to build a replicated Berkeley DB application is to first build (and debug!) the transactional version of the same application. Then, add a thin replication layer to the application. Highly available applications use the following additional four Berkeley DB methods: DB_ENV->rep_elect, DB_ENV->rep_process_message, DB_ENV->rep_start and DB_ENV->set_rep_transport:
To add replication to a Berkeley DB application, application initialization must be changed, and some new code, the application's communications infrastructure, must be written. The application initialization changes are relatively simple, but the communications infrastructure code is fairly complex.
During application initialization, the application must perform two additional tasks: first, it must provide Berkeley DB information about its communications infrastructure, and second, it must start the Berkeley DB replication system. Generally, a replicated application will do normal Berkeley DB recovery and configuration, exactly like any other transactional application. Then, once the database environment has been opened, it will call the DB_ENV->set_rep_transport function to configure Berkeley DB for replication, and then will call the DB_ENV->rep_start function to join or create the replication group. When calling DB_ENV->rep_start, the application has two choices: specifically configure the master for the replication group, or, alternatively, configure all group members as clients and then call an election, letting the clients select the master from among themselves. Either is correct, and the choice is entirely up to the application.
The result of calling DB_ENV->rep_start is usually the discovery of a master, or the declaration of the local environment as the master. If a master has not been discovered after a reasonable amount of time, the application should call DB_ENV->rep_elect to call for an election.
Databases are generally opened read-write on both clients and masters in order to simplify upgrading replication clients to be masters. (If databases are opened read-only on clients, and the client is then upgraded to be the master, the client would have to close and reopen all of its databases in order to support database update queries.) However, even though the database is opened read-write on the client, any attempt to update it will result in an error until the client is reconfigured as a master.
There are no additional interface calls required to shut down a database environment participating in a replication group. The application should shut down the environment in the usual manner, by calling the DB_ENV->close function.
![]() ![]() ![]() |
Copyright Sleepycat Software @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @Import: RPM 4.0.4 @ text @@ 1.1.1.2 log @Import: RPM 4.0.5 @ text @d1 2 a2 2 a3 1 d19 1 a19 1 Then, add a thin replication layer to the application. All highly available d22 1 a22 2 DB_ENV->set_rep_transport and may also use the configuration method DB_ENV->set_rep_limit: d24 1 a24 1
During application initialization, the application performs two d49 9 a57 9 will call the DB_ENV->set_rep_transport method to configure Berkeley DB for replication, and then will call the DB_ENV->rep_start method to join or create the replication group.
When calling DB_ENV->rep_start, the application has two choices: specifically configure the master for the replication group, or, alternatively, configure all group members as clients and then call an election, letting the clients select the master from among themselves. Either is correct, and the choice is entirely up to the application. The result of calling DB_ENV->rep_start is usually the discovery of a d59 2 a60 16 a master has not been discovered after a reasonable amount of time, the application should call DB_ENV->rep_elect to call for an election.
In the case of multiple processes accessing a replicated environment, all of the threads of control expecting to modify databases in the environment or process replication messages must call the DB_ENV->rep_start method. Note that not all processes running in replicated environments need to call DB_ENV->set_rep_transport or DB_ENV->rep_start. Read-only processes running in a master environment do not need to be configured for replication in any way. Processes running in a client environment are read-only by definition, and so do not need to be configured for replication either (although, in the case of clients that may become masters, it is usually simplest to configure for replication on process startup rather than trying to reconfigure when the client becomes a master). Obviously, at least one thread of control on each client must be configured for replication as messages must be passed between the master and the client. d68 1 a68 3 reconfigured as a master. No databases can be opened on clients before calling DB_ENV->rep_start, and attempting to do so will result in an error. d72 1 a72 1 DB_ENV->close method. @ 1.1.1.3 log @Import: RPM 4.1 @ text @d1 2 a2 2 d4 1 d20 1 a20 1 Then, add a thin replication layer to the application. Highly available d23 2 a24 1 DB_ENV->set_rep_transport: d26 1 a26 1
During application initialization, the application must perform two d52 9 a60 9 will call the DB_ENV->set_rep_transport function to configure Berkeley DB for replication, and then will call the DB_ENV->rep_start function to join or create the replication group. When calling DB_ENV->rep_start, the application has two choices: specifically configure the master for the replication group, or, alternatively, configure all group members as clients and then call an election, letting the clients select the master from among themselves. Either is correct, and the choice is entirely up to the application.
The result of calling DB_ENV->rep_start is usually the discovery of a d62 16 a77 2 a master has not been discovered after a reasonable amount of time, the application should call DB_ENV->rep_elect to call for an election. d85 3 a87 1 reconfigured as a master. d91 1 a91 1 DB_ENV->close function. @ 1.1.1.4 log @Import: RPM 4.1.1 @ text @d1 2 a2 2 a3 1 d19 1 a19 1 Then, add a thin replication layer to the application. All highly available d22 1 a22 2 DB_ENV->set_rep_transport and may also use the configuration method DB_ENV->set_rep_limit: d24 1 a24 1
During application initialization, the application performs two d49 9 a57 9 will call the DB_ENV->set_rep_transport method to configure Berkeley DB for replication, and then will call the DB_ENV->rep_start method to join or create the replication group.
When calling DB_ENV->rep_start, the application has two choices: specifically configure the master for the replication group, or, alternatively, configure all group members as clients and then call an election, letting the clients select the master from among themselves. Either is correct, and the choice is entirely up to the application. The result of calling DB_ENV->rep_start is usually the discovery of a d59 2 a60 16 a master has not been discovered after a reasonable amount of time, the application should call DB_ENV->rep_elect to call for an election.
In the case of multiple processes accessing a replicated environment, all of the threads of control expecting to modify databases in the environment or process replication messages must call the DB_ENV->rep_start method. Note that not all processes running in replicated environments need to call DB_ENV->set_rep_transport or DB_ENV->rep_start. Read-only processes running in a master environment do not need to be configured for replication in any way. Processes running in a client environment are read-only by definition, and so do not need to be configured for replication either (although, in the case of clients that may become masters, it is usually simplest to configure for replication on process startup rather than trying to reconfigure when the client becomes a master). Obviously, at least one thread of control on each client must be configured for replication as messages must be passed between the master and the client. d68 1 a68 3 reconfigured as a master. No databases can be opened on clients before calling DB_ENV->rep_start, and attempting to do so will result in an error. d72 1 a72 1 DB_ENV->close method. @