This sample application demonstrates eXtremeDB High Availability with partial replication filters on the replica and master sides. The keyword
localin the schema indicates which classes are subject to partial replication. For example, consider the following schema definitions.For the master database:
#define uint4 unsigned<4> declare database filtermstdb; declare auto_oid [2000]; class T1 { uint4 key; unique tree<key> tkey; }; class T2 { uint4 key; unique tree<key> tkey; }; class T3 { uint4 key; unique tree<key> tkey; }; local class T4 { uint4 key; unique tree<key> tkey; };For the replica database:
#define uint4 unsigned<4> declare database filterrpldb; declare auto_oid [2000]; local class T1 { uint4 key; unique tree<key> tkey; }; class T2 { uint4 key; unique tree<key> tkey; }; class T3 { uint4 key; unique tree<key> tkey; }; class T4 { uint4 key; unique tree<key> tkey; };Objects in the master's local class T4 are not replicated to replica nodes. Data received from the master is not written to the replica's local class T1. Note that local classes on the master and replicas can be different, and it is not necessary to enable binary evolution to use partial replication.
The master application creates and populates the database, then continues to create and delete objects. The master sends only non-local objects to replicas. Replica applications create the database, synchronize with the master database, then receive transaction data from the master. The replica receives only non-local objects.
See instructions here on how to build this and other samples on your development platform. Once built, the sample can be run from the
\target\bindirectory.In a console window, run:
hafilter_masterThen, in a second console window, run:
hafilter_replicaBut it is more instructive to run one instance in your development environment debugger, stepping through the code.