Skip to content

Commit

Permalink
rename parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan authored and 王聃 committed Sep 18, 2024
1 parent 48131f2 commit 0b047f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/replica/replica_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2172,21 +2172,21 @@ bool replica_stub::validate_replica_dir(const std::string &dir,
return true;
}

replica_ptr replica_stub::load_replica(dir_node *dn, const char *dir)
replica_ptr replica_stub::load_replica(dir_node *dn, const char *replica_dir)
{
FAIL_POINT_INJECT_F("mock_replica_load",
[&](std::string_view) -> replica * { return nullptr; });

app_info ai;
gpid pid;
std::string hint_message;
if (!validate_replica_dir(dir, ai, pid, hint_message)) {
LOG_ERROR("invalid replica dir '{}', hint: {}", dir, hint_message);
if (!validate_replica_dir(replica_dir, ai, pid, hint_message)) {
LOG_ERROR("invalid replica dir '{}', hint: {}", replica_dir, hint_message);
return nullptr;
}

// The replica's directory must exist when creating a replica.
CHECK_EQ(dir, dn->replica_dir(ai.app_type, pid));
CHECK_EQ(replica_dir, dn->replica_dir(ai.app_type, pid));
auto *rep = new replica(this, pid, ai, dn, false);
const auto err = rep->initialize_on_load();
if (err != ERR_OK) {
Expand All @@ -2195,8 +2195,8 @@ replica_ptr replica_stub::load_replica(dir_node *dn, const char *dir)
rep = nullptr;

// clear work on failure
if (dsn::utils::filesystem::directory_exists(dir)) {
move_to_err_path(dir, "load replica");
if (dsn::utils::filesystem::directory_exists(replica_dir)) {
move_to_err_path(replica_dir, "load replica");
METRIC_VAR_INCREMENT(moved_error_replicas);
_fs_manager.remove_replica(pid);
}
Expand Down
8 changes: 4 additions & 4 deletions src/replica/replica_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ class replica_stub : public serverlet<replica_stub>, public ref_counter
static bool
parse_replica_dir_name(const std::string &dir_name, gpid &pid, std::string &app_type);

// Load an existing replica which is located in `dn` with `dir`. Usually each different
// `dn` represents a unique disk. `dir` is the absolute path of the directory for a
// replica.
virtual replica_ptr load_replica(dir_node *dn, const char *dir);
// Load an existing replica which is located in `dn` with `replica_dir`. Usually each
// different `dn` represents a unique disk. `dir` is the absolute path of the directory
// for a replica.
virtual replica_ptr load_replica(dir_node *dn, const char *replica_dir);

// The same as the above `load_replica` function, except that this function is to load
// each replica to `reps` with protection from `reps_lock`.
Expand Down

0 comments on commit 0b047f9

Please sign in to comment.