Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Wake up on a specified schedule
  2. Identify node with state ‘ADVISED’
  3. Lock database, update timestamp, unlock the database
  4. Model sync
  5. Update the state of the node to ‘READY’

...

It is identified that a ‘lock’ can also be implemented in the DB plugin, CPS, and the client (NCMP) or combination of these.

Locking method scenarios


ScenarioDescription
1Only anchor table row is locked
  • can be implemented through PostgreSQL
  • Client options
    1. query for 'LOCKED' anchor every mutation
    2. handle failure for 'LOCKED' anchor
2anchor and every fragment associated with the anchor is locked
  • locks every relevant fragment row in the fragment table associated with the anchor
  • adds new exception to identify that fragment is 'LOCKED'

Issues and decisions


DescriptionIssuesNotesDecisions
1Scenario #2 is chosen as the method for locking anchor
  • locks all fragment when we lock metadata anchor i.e. metadata of all cm handle will be locked
    • metadata of every cm handle is frozen until the first lock is released
  • we don't need to lock the anchor but lock just the fragment
    • locks only the relevant row 
    • this way client can lock another fragment in parallel
    • client (NCMP) can pass the XPath to specify the fragment they want to lock
  • Options for scenario 2
    1. extend lock capability to the fragment
    2. change the model for storing metadata
  • the team decided to go for option #1 for scenario 2 
    • don't need to specify anchor as it is given by FK
    • you need the path for the fragment
2To implement a lock we must do it inside a transaction
  • Session must be introduced in JAVA API (CPS CORE)
  • query and 'LOCK FOR UPDATE' relevant rows in fragment table inside a transaction
  • no persistency
  • this will be a local transaction between the CPS instance and the database
3Locking of anchor on multiple namespaces