|The recommendations here are under development and may change before implementation.|
The intent of the REPLICA READ (also known as CMD_GET_REPLICA in the server) operation is to allow a client to perform retrieval operations only against one or more replicas. This would be an inconsistent read. While it could be used for nearly any purpose, the only common use case is expected to be in the event of failures when a known inconsistent read is okay.
Note: Not correct, needs updating
|These recommendations are preliminary.|
When a client library is processing a request on behalf of the end user, it should generally walk the list of current replicas for the vbucket to which the given key matches.
The conversation then is something along these lines.
- Application tries to retrieve item, client library cannot service this and thus replies with an error or a timeout.
- Application then requests a replica read through a similar API as listed above.
- Client library retrieves from the current configuration a map of all nodes for the item requested. Over the course of handling this function invocation by the application, it will continue to use this sequence of primary locations and replica locations even though the map may change.
- Optionally, the client may provide a function which retrieves an array/map or other structure which contains the given item and the CAS (and optionally, the expiration) from all replicas it can contact. This would be provided as a way of allowing applications to determine what the most up-to-date version of an item may be since we are not guaranteed the replication is in the order it is present in the configuration.
- The client library will then attempt to retrieve the item from each replica in the configuration, in the specified order in the configuration until the item has been retrieved or until the list of replicas has been exhausted. Upon receiving a response from a given replica, it will then return that value to the calling application.
REPLICA READ is a binary protocol only operation. It could be implemented in ASCII, but that would require changes in moxi and additional clients.
See authoritative protocol documentation. This section serves only as a reference.