empiredan commented on code in PR #2387:
URL:
https://github.com/apache/incubator-pegasus/pull/2387#discussion_r3027041687
##########
src/replica/replica_2pc.cpp:
##########
@@ -183,7 +183,13 @@ void replica::on_client_write(dsn::message_ex *request,
bool ignore_throttling)
if (FLAGS_reject_write_when_disk_insufficient &&
(_dir_node->status != disk_status::NORMAL ||
_primary_states.secondary_disk_abnormal())) {
- response_client_write(request,
disk_status_to_error_code(_dir_node->status));
+ if (_dir_node->status != disk_status::NORMAL) {
+ // Primary replica disk is abnormal, return the corresponding
error code
+ response_client_write(request,
disk_status_to_error_code(_dir_node->status));
+ } else {
+ // Secondary replica disk is abnormal but primary is OK
+ response_client_write(request, ERR_REPLICATION_FAILURE);
Review Comment:
I tend to prefer returning `ERR_DISK_INSUFFICIENT` or `ERR_DISK_IO_ERROR`
for disk issues on secondary replicas as well. The reasons are as follows:
1. Whether primary or secondary, they are essentially replicas of the data.
From a high-level perspective, any disk issue on a replica results in a failure
to write data.
2. A two-dimensional classification is introduced if disk issues on primary
and secondary replicas are represented by different error codes, which will
bloat the error code system.
--
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]