Documente Academic
Documente Profesional
Documente Cultură
- Always remember that even with a single instance, some use cases can create data inconsistencies, e.g.:
- User A open Partner1 in edit mode
- User B opens same Partner1 in edit mode
- User A changes its name to Partner1-A, email to partner1a@trobz.com and saves
- User B changes its name to Partner1-B and saves
- Final name of Partner1 is Partner1-B, with email partner1a@trobz.com
© Trobz 2009-2016 - All rights reserved 10
4) Potential components
Sync using single master + API
- Solution
- We define a single master for each entity
- Whenever we want to create/update a common entity, we call the master through a REST API
- Problems
- Synchronous
- Strong coupling
- Strong change of Odoo
- Need to handle with errors
- If changes from non-owners were immediately applied on all instances, we could face some conflicts:
- Let's imagine a simultaneous change on object A by I1 and I2
- I3 receives change from I1 first, I2 second
- I4 receives from I2 first, I2 second
- If changes are incompatible, I3 and I4 don't have the same view on the object anymore
- With the ownership rule, it's the vision of the object's owner that gets finally replicated on all nodes
- In other words, the owner is the source of truth regarding its own objects
- Common objects synchronized between instances are identified by their unique `(source, source_id)`, where:
- `source` is the identifier of the owner
- `source_is` is the record id on the instance of the owner
- Now, if we want to rely on these events for synchronization of other instances, we need to make sure that:
- the job is successfully processed
- no failure accepted
- if one job fails, all subsequent jobs are stuck until the situation is resolved
- jobs are processed in the same exact order that they are created
- We want model events to be processed strictly in the same order they were sent (at source level)
- We don't want events sent by a given instance to be in a position to block the processing of events from
another instance
- So we use a single dedicated process to consume model events from other instances
- But a job is created for each event
- And we have a dedicated channel per source to process them:
- sequential, with a capacity of 1