ADR 022: GQL compliant notifications #1060
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GQL Summary Statuses
This PR introduces GQL compliant status objects to the
ResultSummary
.It might be changed without following the deprecation policy.
Deprecations
SummaryNotificationPosition
has been deprecated in favor ofSummaryInputPosition
.New GQL Status Objects
A new property
ResultSummary.gql_status_objects
has been introduced. It returns a sequence ofGqlStatusObject
s. These objects contain information about the execution of the query including notifications as they exist now (seeSummaryNotification
) but also an outcome status like00000
for "success",02000
for "no data", and00001
for "omitted result".Eventually, this API is planned to supersede the current notifications API.
The GqlStatusObjects will be presented in the following order:
02xxx
) has precedence over a warning;01xxx
) has precedence over a success.00xxx
) has precedence over anything informational (03xxx
).Notification Filtering
Some status objects are notifications (vendor-specific definition). Those notifications can be identified using
GqlStatusObject.is_notification
. They contain additional information like aclassification
,severity
, andposition
. Further, those notifications can be configured to be suppressed in the DBMS saving bandwidth not having to send them to the client as well as compute not having to check for those conditions.For this, the following driver config options can be used:
notifications_min_severity
(already existing)notifications_disabled_classifications
(new, same as the existingnotifications_disabled_categories
).If both options are provided, they are merged into a single list of disabled classifications/categories.
All filter config options will affect both the current notifications API as well as the notifications among the GQL status objects.
Polyfilling
There are now two APIs to access notifications: the old notifications API and the new GQL status API. To provide an easy migration path the driver will, depending on if the server is GQL aware or not (i.e., recent or old neo4j version), polyfill the API not supported by the server on a best-effort basis. In particular, GQL status objects have a GQLSTATUS code that has not counterpart in non-GQL-aware neo4j versions. Therefore, the driver will fill the GQLSTATUS with either
01N42
for warning notifications and03N42
for informational notifications. Further, such status codes might be used by the server in the transition phase towards full GQL compliance. They indicate a lack of a final status code and will likely change in the future.A list of all possible GQLSTATUS codes is not yet available as the server-side of this change is still very actively being worked on.
Example Usage
Which, when run against an empty 5.19 DBMS, gives the following output
Depends on: