Introducing Cloudsync
Page 6 of 8

Cloudsync Capabilities

Cloudsync provides the usual features that support client/server database applications. It also includes additional capabilities to support distributed applications:

Creating Targets

A publication defines the part of the source database to be shared with a certain set of target databases. A publication can also contain target application code. A single SQL-J command at the source creates a publication that can create and manage any number of targets. A publication restricts the target to only the data the user needs, thus enhancing application performance, security, and transfer time across the network.

See Chapter 2, "Publications", for more information on creating and using publications.

Synchronizing Databases

Disconnected databases in a distributed system can change independently. The process that causes each database to reflect changes in the other databases is called synchronization. In Cloudscape synchronization, the refresh operation, invoked by a single SQL-J command at a target, synchronizes data automatically between the target and the source. Changes initiated at any target (or directly at the source) are propagated to other targets as they refresh. When the refresh operation completes, the target is in agreement with the source and therefore has consistent data.

See Chapter 4, "Synchronizing Databases", for more details on the refresh operation.

Handling Conflicts

Different databases may attempt to change data in conflicting ways, and the refresh operation must handle this. For example, in an order entry application, the system must avoid corruption if a user at one target orders eight items and a user at another target orders seven items, when only ten items are available.

Cloudsync provides a simple framework for handling conflicts:

  • Source Arbitration

    The source is the final arbiter of all transactions on the system. All changes in the synchronized system must apply at the source before being propagated to targets. This makes it unnecessary to resolve conflicts directly between targets. Since targets need not be available to resolve conflicts, they can disconnect at any time.

  • Provisional Transactions

    All transactions originating at a target are provisional until a refresh operation completes. If a transaction is applied successfully at the source during the refresh operation, it becomes durable. If it is rejected at the source, it is rolled back on the target after the refresh.

  • Work Units

    Cloudsync provides a simple, flexible means, the work unit, to specify how to handle a potential conflict when a provisional target data change is applied at the source. Work units are optional. If no conflict is anticipated for a given transaction, the data can synchronize automatically at refresh time without a work unit.

    Work units are ordinary Java methods that describe logical operations on both target and source databases. Cloudsync automatically executes a work unit at the target and the source at the appropriate time.

    See Chapter 6, "Updates and Work Units", for more information on work units.