You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pegasus does not support duplicating atomic write requests including incr, check_and_set and check_and_mutate since they are not idempotent. In practice, various applications use atomic write interfaces in many scenarios. However, such applications cannot use duplication to synchronize data, and therefore cannot benefit from the high performance that duplication provides.
Design
Due to the urgency of the requirements, the first version of the idempotent implementation for the atomic writes should be as simple as possible, without making fundamental changes to the write path.
Therefore, we decided to implement the idempotence of atomic write requests as follows: for each replica, ensure that only one atomic write request is being processed in the write pipeline at any given time. Once the replica server receives an atomic request, firstly it will be cached. It will not be pushed into the write pipeline until all requests before it have been applied. The write pipeline consists of the following stages:
read the current value from RocksDB, calculate the final value according to specific semantics of requested atomic write and build the idempotent request based on it;
append the corresponding mutation to plog;
broadcast the prepare requests to the secondary replicas;
apply the final result back to RocksDB ultimately;
The primary replicas have all 1 ~ 4 stages, and at last reply to the client while the secondary replicas only have stages 2 and 4.
…egasus_server_write` and `replication_app_base` (#2196)
#2197
To support idempotence, a new interface `make_idempotent()` is introduced and
an existing interface `on_batched_write_requests()` is changed for both the classes
`pegasus_server_write` and `replication_app_base`. This is different from what we
have done for `pegasus_write_service` and `pegasus_write_service::impl`, both of
which provide `make_idempotent()` and `put()` by the following PRs:
- #2185
- #2192
`make_idempotent()` for `replication_app_base` is provided as a virtual function
called by primary replicas, implemented internally by `pegasus_server_impl` and
`pegasus_server_write`. `on_batched_write_requests` for `replication_app_base`
is the same. It is changed with a new parameter `original_request` added. It is just
the original request received from the client. It must be an atomic request (i.e. `incr`,
`check_and_set` and `check_and_mutate`) if it is non-null, and used to decide if a
write request is atomic and generate the response corresponding to the atomic write
request.
Motivation
Pegasus does not support duplicating atomic write requests including
incr
,check_and_set
andcheck_and_mutate
since they are not idempotent. In practice, various applications use atomic write interfaces in many scenarios. However, such applications cannot use duplication to synchronize data, and therefore cannot benefit from the high performance that duplication provides.Design
Due to the urgency of the requirements, the first version of the idempotent implementation for the atomic writes should be as simple as possible, without making fundamental changes to the write path.
Therefore, we decided to implement the idempotence of atomic write requests as follows: for each replica, ensure that only one atomic write request is being processed in the write pipeline at any given time. Once the replica server receives an atomic request, firstly it will be cached. It will not be pushed into the write pipeline until all requests before it have been applied. The write pipeline consists of the following stages:
The primary replicas have all 1 ~ 4 stages, and at last reply to the client while the secondary replicas only have stages 2 and 4.
Task List
Making incr requests idempotent:
incr
request idempotent inpegasus_write_service::impl
#2185incr
request idempotent inpegasus_write_service
#2192incr
request idempotent inpegasus_server_write
andreplication_app_base
#2196The text was updated successfully, but these errors were encountered: