empiredan commented on code in PR #2249: URL: https://github.com/apache/incubator-pegasus/pull/2249#discussion_r2108098076
########## src/replica/replica_2pc.cpp: ########## @@ -265,37 +271,43 @@ bool replica::need_make_idempotent(message_ex *request) const } if (!_app_info.atomic_idempotent) { + // The table which this replica belongs to is not configured to make all atomic + // write requests idempotent. return false; } const auto *spec = task_spec::get(request->rpc_code()); - CHECK_NOTNULL(spec, "RPC code {} not found", request->rpc_code()); + CHECK_NOTNULL_PREFIX_MSG(spec, "RPC code {} not found", request->rpc_code()); + // Only atomic write requests need to be made idempotent. return !spec->rpc_request_is_write_idempotent; } int replica::make_idempotent(mutation_ptr &mu) { - CHECK_TRUE(!mu->client_requests.empty()); + CHECK_PREFIX_MSG(!mu->client_requests.empty(), + "the mutation should include at least one request"); message_ex *request = mu->client_requests.front(); if (!need_make_idempotent(request)) { return rocksdb::Status::kOk; } - // The original atomic write request must not be batched. - CHECK_EQ(mu->client_requests.size(), 1); + CHECK_EQ_PREFIX_MSG( + mu->client_requests.size(), 1, "the original atomic write request must not be batched"); - dsn::message_ex *new_request = nullptr; - const int err = _app->make_idempotent(request, &new_request); - if (dsn_unlikely(err != rocksdb::Status::kOk)) { + std::vector<dsn::message_ex *> new_requests; + const int err = _app->make_idempotent(request, new_requests); + if (err != rocksdb::Status::kOk) { Review Comment: When the condition checks of `check_and_set` and `check_and_mutate` fail, `make_idempotent()` would return rocksdb::Status::kTryAgain. Therefore, there is still a certain probability that a status code other than rocksdb::Status::kOk is returned. Also add this into comments. -- 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: dev-unsubscr...@pegasus.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pegasus.apache.org For additional commands, e-mail: dev-h...@pegasus.apache.org