4.6 Keeping the Graph in Oracle Database Synchronized with the Graph Server
You can use the FlashbackSynchronizer
API to automatically apply changes made to graph in the database to the corresponding PgxGraph
object in memory, thus keeping both synchronized.
This API uses Oracle's Flashback Technology to fetch the changes in the database since the last fetch and then push those changes into the graph server using the ChangeSet
API. After the changes are applied, the usual snapshot semantics of the graph server apply: each delta fetch application creates a new in-memory snapshot. Any queries or algorithms that are executing concurrently to snapshot creation are unaffected by the changes until the corresponding session refreshes its PgxGraph
object to the latest state by calling the session.setSnapshot(graph, PgxSession.LATEST_SNAPSHOT)
procedure.
For detailed information about Oracle Flashback technology, see the Database Development Guide.
Prerequisites for Synchronizing
The Oracle database must have Flashback enabled and the database user that you use to perform synchronization must have:
- Read access to all tables which need to be kept synchronized.
- Permission to use flashback APIs. For example:
GRANT EXECUTE ON DBMS_FLASHBACK TO <user>
The database must also be configured to retain changes for the amount of time needed by your use case.
Types of graphs that can be synchronized
Not all PgxGraph
objects in PGX can be synchronized. The following limitations apply:
-
Only the original creator of the graph can synchronize it. That is, the current user must have the MANAGE permission of the graph.
- Only graphs loaded from database tables ("partitioned graphs" and PG View graphs) can be synchronized. Graphs created from other formats or graphs created via the graph builder API or PG View graphs created from database views cannot be synchronized.
- Only the latest snapshot of a graph can be synchronized.
Types of changes that can be synchronized
The synchronizer supports keeping the in-memory graph snapshot in sync with the following database-side modifications:
- insertion of new vertices and edges
- removal of existing vertices and edges
- update of property values of any vertex or edge
The synchronizer does not support schema-level changes to the input graph, such as:
- alteration of the list of input vertex or edge tables
- alteration of any columns of any input tables (vertex or edge tables)
Furthermore, the synchronizer does not support updates to vertex and edge keys.
For a detailed example, see the following topic:
- Synchronizing a PG View Graph
You can synchronize a graph loaded into the graph server (PGX) from a property graph view (PG View) with the changes made to the graph in the database. - Synchronizing a Published Graph
You can synchronize a published graph by configuring the Flashback Synchronizer with aPartitionedGraphConfig
object containing the graph schema along with the database connection details.
Parent topic: Using the Graph Server (PGX)