Sync in spymemcached
Hi Guys,
Due to the fact that views won't update until an item has persisted to disk it is essential that we have some way of blocking until the item in a set/add has persisted to disk.
I've seen mention in various places that this sort of sync support is supposed to be coming in spymemcached. Any idea of when?
Given that the CouchDB style view stuff is currently so separate from the Membase-style cache stuff (i.e. views aren't cached and can't update from cache) it really is essential to have some way of knowing when the data you have written will be available in a view query.
To put it another way, what's the point in having a query block until a view has updated if the underlying data the view is updating from can be stale itself because there are still items waiting to be written from the cache to disk?
Thanks,
Oli.
Thanks Mike, that sounds like just the thing.
Any chance of getting hold of a preview version when the work is finished if that is before release? We are being badly affected by these view issues and currently are having to put threads to sleep for many seconds to be sure items are persisting to disk.
Your best bet is to just wait for the next developer preview of Couchbase Server, otherwise you will have to build the server yourself and the code might still have some issues since you will be using a nightly build.
I also haven't done any work on Spymemcached yet to get the observe stuff added. I'll do my best to try to keep this post updated, but check back with us when we release the next Couchbase Server 2.0 build in case I forget.
We have implemented an "observe" command that will allow you to do exactly everything mentioned in you post. We just finished the server side implementation and the command is undergoing QA testing. We haven't publicly disclosed how this command will work yet since it's not quite finished though. The command is currently scheduled for completion for the release of Couchbase Server 2.0 and it is on track to be finished.
As a developer you will most likely never interact with this command. What you will likely see in Spymemcached is a new function called something like setAndPersist() which will return a Future. The call will be asynchronous by default, but calling get() on the future will cause your application thread to block until the item has been persisted to disk.