-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CBL-5606 : Fix lock caused by saving doc and notifying change
* Issue : When notify collection change, the code needs to obtain the database lock in order to get the database instance from the collection object. The deadlock could occurred if a document save happens at the same time on the other thread as the document save will need to wait to open its transaction while the other transaction is still opened by the notification thead. * Solution : Keep the database pointer without resetting its to null inside the collection objects. As the collection objects cannot retain the database object to avoid retain cycle (collections are cached inside the database object), the database object will need to retain else where where it is being used. Now, the database is explicity retained by Document, Listener Token (Collection and Document Change Listener), and ReplicatorConfiguration objects. * Moved the logic that generates the effective replication collections, retains Collection objects and retains Database object from CBLReplicator class into the ReplicatorConfiguration class so those logics are done in a single place. Added missing document ids filter tests to ensure that the moved logic work correctly for the document ids filter.
- Loading branch information
Showing
11 changed files
with
277 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.