empiredan commented on code in PR #2192:
URL:
https://github.com/apache/incubator-pegasus/pull/2192#discussion_r1956339192
##########
src/server/pegasus_write_service.h:
##########
@@ -202,6 +216,12 @@ class pegasus_write_service :
dsn::replication::replica_base
uint64_t _batch_start_time;
+ // Only used for primary replica to calculate the duration that an incr
request from
+ // the client is translated into an idempotent put request before appended
to plog,
+ // including reading the current value from RocksDB and incrementing it by
a given
+ // amount.
+ uint64_t _make_incr_idempotent_duration_ns;
Review Comment:
This variable is defined as per-replica rather than per-request, for the
reason that the current design for implementing idempotence is to make sure
there is only one atomic request being processed in the write pipeline for each
replica. This pipeline consists of the following stages:
(1) read the current value from RocksDB and built the idempotent request
based on it;
(2) append the corresponding mutation to plog;
(3) broadcast the prepare requests;
(4) apply the result for atomic operation back to RocksDB ultimately.
For a request, this variable will be set in stage (1) and read in stage (4);
since there is only one request in the pipeline, this variable is guaranteed
not to be set for another request before stage (4) is finished. Therefore, it
is safe to define this variable as per-replica.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]