4.6.2 Synchronizing a Published Graph
You can synchronize a published graph by configuring the Flashback
Synchronizer with a PartitionedGraphConfig
object containing the graph
schema along with the database connection details.
The
PartitionedGraphConfig
object can be created either
through the PartitionedGraphConfigBuilder
API or by reading the graph
configuration from a JSON file.
Though synchronization of graphs created via graph configuration objects is supported in general, the following few limitations apply:
- Only partitioned graph configurations with all providers being database tables are supported.
- Each edge or vertex provider or both must specify the owner of the
table by setting the username field. For example, if user
SCOTT
owns the table, then set the user name accordingly for the providers. - Snapshot source must be set to
CHANGE_SET
. - It is highly recommended to optimize the graph for update operations in order to avoid memory exhaustion when creating many snapshots.
The following example shows the sample configuration for creating
the PartitionedGraphConfig
object:
{
...
"optimized_for": "updates",
"vertex_providers": [
...
"username":"<username>",
...
],
"edge_providers": [
...
"username":"<username>",
...
],
"loading": {
"snapshots_source": "change_set"
}
}
GraphConfig cfg = GraphConfigBuilder.forPartitioned()
…
.setUsername("<username>")
.setSnapshotsSource(SnapshotsSource.CHANGE_SET)
.setOptimizedFor(GraphOptimizedFor.UPDATES)
...
.build();
As a prerequisite requirement, you must have a graph that is published
in an earlier session. For example:
opg4j> var graph = session.readGraphWithProperties("<path_to_json_config_file>")
graph ==> PgxGraph[name=bank_graph_analytics_fb,N=999,E=4993,created=1664310157103]
opg4j> graph.publishWithSnapshots()
PgxGraph graph = session.readGraphWithProperties("<path_to_json_config_file>");
graph.publishWithSnapshots();
>>> graph = session.read_graph_with_properties("<path_to_json_config_file>")
>>> graph.publish_with_snapshots()
You can now perform the following steps to synchronize the published graph using a graph configuration object which is built from a JSON file.