On May 2, 2014, at 8:20 AM, Yaron Goland <[email protected]> wrote:
> So today, in theory anyway, I should be able to set up two separate listeners > on the same box (Android or otherwise) and have both listeners talk to the > same database file without problem. SQLite certainly supports this behavior. This won't quite work. The Document class wants to know when changes are made to the database so it can update its internal state like currentRevision. Internally, when multiple threads are using the same database file, they post notifications so one Database instance can discover that another one has changed documents. (This happens during replication, for example.) But those notifications are within the process, so if two processes have the same database open they won't notify each other. This wouldn't be that hard to fix (assuming that Android has interprocess notifications?) but it's just never come up as something that needed to be done. It's a non-issue on iOS due to app sandboxing. > But I've heard Jens mentioning that Couchbase Lite might be changing their > underlying database. > So I wanted to check how committed is Couchbase to continuing this behavior? ForestDB fundamentally has good concurrency support. (Better than SQLite's, in that a writer doesn't block readers.) But I think at the moment it doesn't have any way to arbitrate multiple processes trying to write to the database at the same time; they won't corrupt the database, it's just that the last one to commit would probably overwrite the other's changes. I'll ask the team if that's so, and if they plan to add some kind of file-locking to guard against that. (If not, it's something CBL could probably add on its own.) --Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/68E7AE8C-C607-4A42-A1B3-38D4F7F1D2E7%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
