-
Notifications
You must be signed in to change notification settings - Fork 31
STITCH-1958 - Implement atomic sync operations #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
da859df
to
187f94f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM! Great job. I imagine it might be tough to write an integration test for this, but it would be nice to see a unit test or two to test the recovery functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Couple nits and q's, and I agree with Jason that a test would be nice.
...ain/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
Show resolved
Hide resolved
...ain/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
Outdated
Show resolved
Hide resolved
...ain/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
Outdated
Show resolved
Hide resolved
...ain/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
Show resolved
Hide resolved
...ain/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
General algorithm and implementation status:
For each operation
1. Take out a collection level (NS) lock (done)
2. For reads
2a. do a normal read and release the lock (done)
3. For writes
3a. find documents to be affected (done)
3b. Write the documents to an undo collection (done)
3c. do the write to the local collection (done)
3d. mark the document config as having an uncommitted write (done)
3e. remove the undo document (done)
4. Unlock the collection level lock (done)
For sync
1. For each namespace to synchronize, take out a lock when wanting to making read/writes on doc configs/local collection (done)
On DataSynchronizer startup
1. Lock the NS and dispatch a request to do the below (done)
2. Search for any undo documents (done)
3. Replace the local database version of the document with the undo document (done)
4. Set difference of local docs and configs. Remove difference from local docs (done)
5. Unlock the NS (done)
Drive-bys: