Skip to content

Commit

Permalink
refactor: fs manager
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jun 8, 2023
1 parent d216696 commit 3d4b881
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/replica/replica.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,14 @@ void replica::on_client_read(dsn::message_ex *request, bool ignore_throttling)
auto storage_error = _app->on_request(request);
if (dsn_unlikely(storage_error != ERR_OK)) {
switch (storage_error) {
// TODO(yingchun): Now only kCorruption is dealt, consider to deal with more storage
// engine errors.
// TODO(yingchun): Now only kCorruption and kIOError is dealt, consider to deal with
// more storage engine errors.
case rocksdb::Status::kCorruption:
handle_local_failure(ERR_RDB_CORRUPTION);
break;
case rocksdb::Status::kIOError:
handle_local_failure(ERR_DISK_IO_ERROR);
break;
default:
LOG_ERROR_PREFIX("client read encountered an unhandled error: {}", storage_error);
}
Expand Down
6 changes: 5 additions & 1 deletion src/replica/replica_failover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
* xxxx-xx-xx, author, fix bug about xxx
*/

#include <atomic>
#include <string>

#include "common/fs_manager.h"
#include "common/replication_common.h"
#include "common/replication_enums.h"
#include "dsn.layer2_types.h"
Expand All @@ -54,7 +56,9 @@ void replica::handle_local_failure(error_code error)
{
LOG_INFO_PREFIX("handle local failure error {}, status = {}", error, enum_to_string(status()));

if (error == ERR_RDB_CORRUPTION) {
if (error == ERR_DISK_IO_ERROR) {
_dir_node->status = disk_status::IO_ERROR;
} else if (error == ERR_RDB_CORRUPTION) {
_data_corrupted = true;
}

Expand Down
8 changes: 6 additions & 2 deletions src/replica/replica_learn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,8 +1238,12 @@ void replica::handle_learning_error(error_code err, bool is_local_error)
err,
is_local_error ? "local_error" : "remote error");

if (is_local_error && err == ERR_RDB_CORRUPTION) {
_data_corrupted = true;
if (is_local_error) {
if (err == ERR_DISK_IO_ERROR) {
_dir_node->status = disk_status::IO_ERROR;
} else if (err == ERR_RDB_CORRUPTION) {
_data_corrupted = true;
}
}

_stub->_counter_replicas_learning_recent_learn_fail_count->increment();
Expand Down
6 changes: 4 additions & 2 deletions src/replica/replication_app_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,12 @@ error_code replication_app_base::apply_mutation(const mutation *mu)
// an error.
if (!has_ingestion_request) {
switch (storage_error) {
// TODO(yingchun): Now only kCorruption is dealt, consider to deal with more storage
// engine errors.
// TODO(yingchun): Now only kCorruption and kIOError are dealt, consider to deal with
// more storage engine errors.
case rocksdb::Status::kCorruption:
return ERR_RDB_CORRUPTION;
case rocksdb::Status::kIOError:
return ERR_DISK_IO_ERROR;
default:
return ERR_LOCAL_APP_FAILURE;
}
Expand Down

0 comments on commit 3d4b881

Please sign in to comment.