Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 7eef07b

Browse files
tb06904cn337131p29876wb36499
authored
Gh-534: Additional updates for federated POC (#539)
* basic page layout * configuration options page * finish the configuration page * Add access control docs * operation handling info * add additional information * Apply suggestions from code review Co-authored-by: cn337131 <[email protected]> Co-authored-by: p29876 <[email protected]> * address comments * update federated docs * Apply suggestions from code review Co-authored-by: cn337131 <[email protected]> * address comments --------- Co-authored-by: cn337131 <[email protected]> Co-authored-by: p29876 <[email protected]> Co-authored-by: wb36499 <[email protected]>
1 parent 752fab8 commit 7eef07b

File tree

3 files changed

+74
-21
lines changed

3 files changed

+74
-21
lines changed

docs/administration-guide/gaffer-stores/federated-store.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Federated Store
22

3+
!!! warning
4+
The current version of the federated store and how it currently operates is deprecated, it will be replaced by the current [simple federated store](./simple-federated/configuration.md#) in v2.4.0.
5+
36
The Federated Store is a Gaffer store which forwards operations to a collection of sub-graphs and returns a single response as though a single graph were queried.
47

58
## Introduction

docs/administration-guide/gaffer-stores/simple-federated/additional-info.md

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@ operation. These can be used to do things like pick graphs or control the
1616
merging, a full list of the available options are outlined in the following
1717
table:
1818

19-
| Option | Description |
20-
| --- | --- |
21-
| `federated.graphIds` | List of graph IDs to submit the operation to, formatted as a comma separated string e.g. `"graph1,graph2"` |
22-
| `federated.excludedGraphIds` | List of graph IDs to exclude from the query. If this is set any graph IDs on a `federated.graphIds` option are ignored and instead, all graphs are executed on except the ones specified e.g. `"graph1,graph2"` |
23-
| `federated.aggregateElements` | Should the element aggregator be used when merging element results. |
24-
| `federated.forwardChain` | Should the whole operation chain be sent to the sub graph or not. If set to `false` each operation will inside the chain will be sent separately, so merging from each graph will happen after each operation instead of at the end of the chain. This will be inherently slower if turned off so is `true` by default. |
19+
| Option | Default | Description |
20+
| --- | --- | --- |
21+
| `federated.graphIds` | None | List of graph IDs to submit the operation to, formatted as a comma separated string e.g. `"graph1,graph2"` |
22+
| `federated.excludedGraphIds` | None | List of graph IDs to exclude from the query. If this is set any graph IDs on a `federated.graphIds` option are ignored and instead, all graphs are executed on except the ones specified e.g. `"graph1,graph2"` |
23+
| `federated.aggregateElements` | See store properties | Should the element aggregator be used when merging element results. |
24+
| `federated.useDefaultGraphIds` | None | Explicitly specifies that the default Graph IDs from the store.properties file should be used. By default if no graph ID options are specified the default graph IDs will still be used where applicable. However, specifying this on an operation chain means the whole chain will be sent to the sub graph, and so merging from each graph will happen at the end of the chain instead of after each operation, hopefully increasing performance.
25+
| `federated.separateResults` | `false` | A boolean option to specify if the results from each graph should be kept separate. If set, this will return a map where each key value is the graph ID and its respective result. |
26+
| `federated.skipGraphOnFail` | `false` | A boolean option to specify if the operation should continue even if it fails on one or more of the sub graphs. |
2527

2628
Along with the options above, all merge classes can be overridden per query
2729
using the same property key as you would via the store properties. Please see
2830
the table [here](./configuration.md#store-properties) for more information.
2931

3032
If you wish to submit different operations to different graphs in the same query
31-
you can do this using the `federate.forwardChain` option. By setting this to
32-
false on the outer operation chain the options on the operations inside it will
33-
be honoured. An example of this can be seen below:
33+
you can do this by omitting any graph ID options on the outer operation chain.
34+
You can then specify the graph IDs on the individual operations in the chain
35+
instead. An example of this can be seen below:
3436

3537
!!! note
3638
This will turn off any merging of the results at the end of the chain, the
@@ -44,9 +46,6 @@ be honoured. An example of this can be seen below:
4446
```json
4547
{
4648
"class": "OperationChain",
47-
"options": {
48-
"federated.forwardChain": false
49-
},
5049
"operations": [
5150
{
5251
"class": "GetElements",
@@ -77,21 +76,60 @@ graphs that have been added to the store. This means all features available to
7776
normal caches are also available to the graph storage, allowing the sharing and
7877
persisting of graphs between instances.
7978

80-
The federated store will use the default cache service to store graphs in. It
81-
will also add a standard suffix meaning if you want to share graphs you will
82-
need to set this to something other than the graph ID (see [here](../store-guide.md#cache-service)).
79+
The federated store will use the default cache service to store graphs in. It will
80+
also store graphs in a cache named `"federatedGraphCache_"` followed by the graph
81+
ID of the federated store. You may wish to change this to have common storage
82+
of graphs between stores using the `gaffer.store.federated.graphCache.name`
83+
store property.
84+
85+
### Named Operations and Views
86+
87+
Named Operations and Views can be added to different caches if specified. By
88+
passing graph IDs in the add operation (e.g. `AddNamedOperation`) you can make
89+
the Named Operation or View specific to the graph(s) you specified. However,
90+
this will mean if you try to run it on another graph it will not be available.
91+
92+
If you do not specify any graph IDs in the add operation, any Named
93+
Operations/Views will instead be added to the federated store's cache. By doing
94+
this anything Named will be resolved before forwarding to sub graphs meaning in
95+
essence it is available to all sub graphs.
96+
97+
!!! example ""
98+
=== "Add to a sub graph"
99+
```java
100+
final AddNamedOperation addNamedOp = new AddNamedOperation.Builder()
101+
.option(FederatedOperationHandler.OPT_GRAPH_IDS, "subGraph")
102+
.name("NamedOperation")
103+
.operationChain(new OperationChain.Builder()
104+
.first(new GetAllElements())
105+
.build())
106+
.build();
107+
```
108+
109+
=== "Add to a federated store"
110+
```java
111+
final AddNamedOperation addNamedOp = new AddNamedOperation.Builder()
112+
.name("NamedOperation")
113+
.operationChain(new OperationChain.Builder()
114+
.first(new GetAllElements())
115+
.build())
116+
.build();
117+
```
83118

84119
## Schema Compatibility
85120

86-
When querying multiple graphs, the federated store will attempt to merge each graph's schema together. This means the schemas will need to be
87-
compatible in order to query across them. Generally you will need to ensure
88-
any shared groups can be merged correctly, a few examples of criteria to
89-
consider are:
121+
When querying multiple graphs, the federated store will attempt to merge each
122+
graph's schema together. This means the schemas will need to be compatible in
123+
order to query across them. Generally you will need to ensure any shared groups
124+
can be merged correctly, a few examples of criteria to consider are:
90125

91126
- Any properties in a shared group defined in both schemas need to have the same
92127
type and aggregation function.
93-
- Any visibility properties need to be compatible or they will be removed from the
94-
schema.
128+
- If the visibility property has been defined differently in each schema it will
129+
be removed from the merged schema. This does not effect the actual visibility
130+
of the data as that will still be applied at the sub graph level.
95131
- Groups with different properties in each schema will be merged so the group has
96132
all the properties in the merged schema.
97133
- Any groupBy definitions need to be compatible or will be removed.
134+
- If the vertex serialiser has been defined differently in each schema it will
135+
be removed from the merged schema.

docs/administration-guide/gaffer-stores/simple-federated/configuration.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ specific to a federated store and their usage.
4343
| `gaffer.store.federated.default.graphIds` | `""` | The list of default graph IDs for if a user does not specify what graph(s) to run their query on. Takes a comma separated list of graph IDs e.g. `"graphID1,graphID2"` |
4444
| `gaffer.store.federated.allowPublicGraphs` | `true` | Are graphs with public access allowed to be added to this store. |
4545
| `gaffer.store.federated.default.aggregateElements` | `false` | Should queries aggregate returned Gaffer elements together using the binary operator for merging elements. False by default as it can be slower meaning results are just chained into one big list. |
46+
| `gaffer.store.federated.graphCache.name` | `"federatedGraphCache_<graphId>"` | The name of the cache that the federated store will store its graphs in. This allows sharing of graphs between different federated stores if the cache name is the same (and same default implementation). |
4647
| `gaffer.store.federated.merge.number.class` | `uk.gov.gchq.koryphe.impl.binaryoperator.Sum` | Default binary operator for merging [`Number`](https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html) results (e.g. from a `Count` operation) from multiple graphs. |
4748
| `gaffer.store.federated.merge.string.class` | `uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat` | Default binary operator for merging [`String`](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html) results from multiple graphs. |
4849
| `gaffer.store.federated.merge.boolean.class` | `uk.gov.gchq.koryphe.impl.binaryoperator.And` | Default binary operator for merging [`Boolean`](https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html) results from multiple graphs. |
@@ -64,6 +65,11 @@ satisfy Java's [`BinaryOperator`](https://docs.oracle.com/javase/8/docs/api/java
6465
interface, you can then specify it using the property key for the data type you
6566
wish to use it for.
6667

68+
!!! note
69+
Please note you currently can't chose a merge operator for operations that
70+
return an `Iterable` type, they will always just be chained together (an
71+
iterable of `Element`s is an obvious exception, please see below).
72+
6773
### The Default Element Merge Operator
6874

6975
The default operator used to merge Gaffer elements is unique compared to the
@@ -95,6 +101,12 @@ to the individual graph results, this means two results separately will
95101
satisfy the `View` but once aggregated they may not.
96102
- If you wish to write or use your own operator for merging elements the class
97103
must extend the [`ElementAggregateOperator`](https://github.com/gchq/Gaffer/blob/develop/store-implementation/simple-federated-store/src/main/java/uk/gov/gchq/gaffer/federated/simple/merge/operator/ElementAggregateOperator.java).
104+
- If you have chosen in the schema to use a time sensitive aggregation function
105+
(e.g. [`First`](../../../reference/binary-operators-guide/koryphe-operators.md#first))
106+
for a property that is in multiple sub graphs, you may end up with duplicates
107+
in the result as the aggregator does not know which sub graph is first or
108+
last. This means you may get duplicates of the same vertex but with different
109+
properties in the result.
98110

99111
## Adding and Removing Graphs
100112

0 commit comments

Comments
 (0)