# HA_Filter

> This sample application demonstrates eXtremeDB High Availability with partial replication filters on replica and master sides. The keyword `local` in the schema indicates what classes are subject to the 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;
>         };

> Local class objects (class T4) from the master database don't get replicated to replica nodes; the contents of the local class objects from the replica database (class T1) do not get written into the database when it's received from the master. Note that local classes on the master and replicas can be different and it is not necessary to enable binary evolution to enforce the partial replication.

> The master application creates and populates the database, then continues to create and delete objects. The master sends to replicas only non-local objects. Replica applications create the database, synchronize with the master database, then receive transaction data from the master. The replica receives only non-local objects.

### How to Run

> 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\bin` directory.

> In a console window run:

>         hafilter_master

> Then in a second console window run:

>         hafilter_replica

> But it is more instructive to run one instance in your development environment debugger, stepping through the code.

Related Topics