Where do watches register themselves?

(Amarjeet) #1

Lets say I register a watch on a key. Based on the changes in the key my watch triggers a function. My app runs on JVM.
What will happen if my JVM dies - will watch registration be lost?
And, do watches conform to the replication pattern (in distributed environment) as data in the FDB do?

(A.J. Beamon) #2

Typically, both the client and a storage server are involved in monitoring the watch. In the normal path, what happens is that a watch request gets sent to a single storage server that is responsible for the key. The client waits for a response from this server, and if it gets notified that the value changed or some types of errors occurred, it will notify the user.

If the storage server that holds the watch fails, has the watch open for a long time, has too many watches, or has the data moved away, etc, then the client will be notified of this and can try issuing its watch again, possibly to a different storage server. In the case where the storage servers have reached the watch limit, this essentially falls back to the client running a polling loop.

If the client dies, there’s no way for you to be notified when the watch triggers. The storage server watch timeout that I alluded to above is used to deal with this scenario, as it results in the watch eventually being flushed from the storage server.

(Amarjeet) #3

Thanks @ajbeamon, this is helpful.