Details
-
Story
-
Status: Closed
-
Medium
-
Resolution: Done
-
None
Description
Team discussion on approaches:
- consider kubernetes job Pros
- pro: schedule configurable
- pro: possible retry mechanism
- multiple instances ?
- pro: monitoring
- Con: tight to kubernetes
- Java/Spring schedule (This is what is being implemented)
- pro: schedule using springboot parameters
- Retry mechanism?
- pro: more control
- pro: instances follows NCMP instances
- pro: simpler
- pro: independent of kubernetes
- pro: function part of NCMP feature
steps, each NCMP will have 1 watchdog process that:
- Wake up every minute(configurable) using springboot schedule with a fixed-delay
- query top 1 where state='ADVISED'
- execute model-sync (on watch dog thread)
- If model sync fails, cm handle state = "LOCKED"
- set state to 'READY' (consider state engine, see ref below)
- Go back to step 2 and repeat
References:
- https://wiki.onap.org/display/DW/CPS-799+Spike%3A+Define+states+and+state+handling+for+CM+handle
- https://wiki.onap.org/display/DW/CPS-872+CM+Handle+State%3A+define+and+agree+new+dmi-registry+yang+model+supporting+States
- https://www.baeldung.com/java-enum-simple-state-machine
- https://reflectoring.io/spring-scheduler/
Notes
- Refactor existing model sync code into separate package and classes so it can be used by both sync(current) service and new watchdog process (subtask, separate commit!) Has been done as part of https://jira.onap.org/browse/CPS-950
- (Re-)use model-sync code to separate (watchdog) process which regularly checks DB for 'ADVISED' CM handles and will attempt to perform modelsync on those
- Agree timing with team
- Single CM-Handle to be worked on at a time.
- Use DB Locking (timestamp field) to prevent multiple instances attempting to sync the same CM Handle (Working on single cm-handle at a time, multiple instances shouldn't sync together)
- Update State to READY when model sync completed (and remove timestamp)
- Update State to LOCKED_MISBEHAVING when sync fails (use timeout - decision hasn't been on timeout duration)
- Consider what to do when still busy with previous sync (should NOT start new sync, can only sync one cm-handle at a time)
- Ensure central (single class) handler for state-transitions
Testing
- code is not 'really active' will need to be triggered by setting state on a cm-handle using DB interaction
A/C
- Demo watchdog sync using 'sql-trigger' when change is detected on a node, or time based mechanism which runs on a yet to be determined schedule
- success
- fail
- Demo timer configuration for watchdog
- (snapshot) documentation of relevant configuration
Attachments
Issue Links
- blocks
-
CPS-876 CM Handle State: Remove model-sync from registration process
-
- Closed
-
-
CPS-877 CM Handle State: Exclude any CM-Handles from queries/operations that are not in state 'READY'
-
- Closed
-
-
CPS-878 CM Handle State: Retry CM-Handles that are LOCKED, Failed-to-Sync
-
- Closed
-
-
CPS-909 Separate NCMP endpoint for ch/{cm-handle}/properties and ch/{cm-handle}/state
-
- Closed
-
-
CPS-1019 Create cm-handle state NCMP endpoint
-
- Closed
-
- is blocked by
-
CPS-874 CM Handle State: Update Registry Schema using Liquibase
-
- Closed
-
-
CPS-898 Create method to Lock an Anchor Entity
-
- Closed
-
-
CPS-1042 Introduce dmi-registry latest registry model changes(state)
-
- Closed
-
- relates to
-
CPS-1000 Create Data Synchronization watchdog
-
- Closed
-
Gerrit Reviews
# | Subject | Branch | Project | Status | CR | V |
---|---|---|---|---|---|---|
128718,17 | Watchdog-process that changes CM Handles state | master | cps | Status: MERGED | +2 | +1 |
129102,10 | Watchdog-process that syncs 'ADVISED' CM Handles | master | cps | Status: MERGED | +2 | +1 |
129155,10 | Watchdog Process-Make Configurable | master | cps | Status: MERGED | +2 | +1 |
129181,1 | Add ncmp tag to application yaml | master | cps | Status: MERGED | +2 | +1 |
129214,5 | [CPS] Add Configurable Paramaters to OOM | master | oom | Status: ABANDONED | -2 | -1 |
129274,1 | Remove NCMP tag from properties | master | cps | Status: MERGED | +2 | +1 |
129322,22 | Module Sync Lock State implementation | master | cps | Status: MERGED | +2 | +1 |