Objective
As of current implementation in cps core, after the update operation, entire configuration is sent as Kafka Notification. we are proposing to send only changed configuration as delta report in notification. It will help to understand what configuration exactly changed for the anchor.
Issues & Decisions
# | Issue | Notes | Decision |
---|---|---|---|
1 | Do we need to update existing update notification to send delta notification or delta notification along with existing notification. | 29-Sep-2023: We decided to implement delta notification separately without changing the existing update notification. | |
Event Schema
For delta notification we can use the existing cps data update event schema (cps-data-update-event-schema.json).
# | ||
---|---|---|
1 | id | UUID of the event |
2 | source | urn:cps:org.onap.cps |
3 | schema | urn:cps:org.onap.cps:data-updated-event-schema:v1 |
4 | type | org.onap.cps.data-updated-delta-event |
5 | content | { "operation": "UPDATE", } |
Controlling Notification
It is important to control the delta notification for better performance. we need to decide on below options to control delta notification.
Option | Pros and Cons | Decision |
---|---|---|
Send delta notification for the update operation when update request contains optional query parameter to receive notification. | Pros:
Cons:
| |
Configure dataspace/anchor in yaml file to allow delta notification. | Pros:
Cons:
| |
while creating dataspace/anchor, configure to send delta notification. | Pros:
Cons:
| We decided to try this approach. detailed implementation provided below. |
Implementation of controlling delta notification
Delta notification can be enabled/disabled by an additional admin API for a given anchor name. New API will be added as below.
API : PUT https://IP:PORT/cps/api/v2/dataspace/<dataspace-name>/deltanotification
Request body:
[
{
"anchorName": "anchor01",
"subscribeDeltaNotification": true
},
{
"anchorName": "anchor02",
"subscribeDeltaNotification": true
}
]
Additional field will be added to Anchor table to persist delta notification subscription. newly added field details are as below.
Updated Table | Anchor |
new field name | notification |
type | text |
example | true (string). change later. |
Open questions to be discussed:
Option | description | Decision |
---|---|---|
Is it OK to modify Postgres tables instead of using a yang modelled data approach... (this will require Liquibase steps) | TD : Toine Siebelink need to discuss with Architects and update | |
generic text field OK for future refinement, maybe consider json? |
Implementation details
- For data nodes update operation, generate delta report by comparing previous and current configuration after successful update.
- Process data update delta event and send notification as described in event schema above.