Skip to content

Commit

Permalink
3
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jun 4, 2023
1 parent 0105cfc commit 0317989
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/common/fs_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iosfwd>
#include <utility>

Expand All @@ -44,8 +45,8 @@
#include "fmt/core.h"
#include "fmt/ostream.h"
#include "perf_counter/perf_counter.h"
#include "replica_admin_types.h"
#include "runtime/api_layer1.h"
#include "runtime/rpc/rpc_address.h"
#include "utils/fail_point.h"
#include "utils/filesystem.h"
#include "utils/fmt_logging.h"
Expand Down
3 changes: 2 additions & 1 deletion src/common/fs_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <gtest/gtest_prod.h>
#include <stdint.h>
#include <functional>
#include <atomic>
#include <map>
#include <memory>
#include <set>
Expand All @@ -37,6 +37,7 @@ namespace dsn {
class gpid;

namespace replication {
class disk_info;

DSN_DECLARE_int32(disk_min_available_space_ratio);

Expand Down
7 changes: 4 additions & 3 deletions src/common/test/fs_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ TEST(fs_manager, initialize)
{
std::string create_dir_ok;
std::string check_dir_rw_ok;
int32_t data_dir_size;
} tests[]{{"true", "true", 3}, {"true", "false", 2}, {"false", "false", 2}};
// Regardless of the status of the disk, the number of dir_nodes should be 3.
int32_t dir_node_size;
} tests[]{{"true", "true", 3}, {"true", "false", 3}, {"false", "false", 3}};
int i = 0;
for (const auto &test : tests) {
fail::cfg("filesystem_create_directory", "return(" + test.create_dir_ok + ")");
fail::cfg("filesystem_check_dir_rw", "return(" + test.check_dir_rw_ok + ")");
fs_manager fm;
fm.initialize({"disk1", "disk2", "disk3"}, {"tag1", "tag2", "tag3"});
ASSERT_EQ(test.data_dir_size, fm.get_dir_nodes().size()) << i;
ASSERT_EQ(test.dir_node_size, fm.get_dir_nodes().size()) << i;
i++;
}
fail::teardown();
Expand Down
2 changes: 2 additions & 0 deletions src/replica/disk_cleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
#include <stdint.h>
#include <sys/types.h>
#include <algorithm>
#include <atomic>

#include "common/fs_manager.h"
#include "metadata_types.h"
#include "runtime/api_layer1.h"
#include "utils/error_code.h"
#include "utils/filesystem.h"
Expand Down
1 change: 1 addition & 0 deletions src/replica/replica_2pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <fmt/core.h>
#include <inttypes.h>
#include <stddef.h>
#include <atomic>
#include <chrono>
#include <functional>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions src/replica/replica_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* xxxx-xx-xx, author, fix bug about xxx
*/

#include <atomic>
#include <chrono>
#include <memory>
#include <unordered_map>
Expand Down
4 changes: 0 additions & 4 deletions src/replica/replica_disk_migrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

#include <boost/algorithm/string/replace.hpp>
#include <fmt/core.h>
#include <fmt/ostream.h>
#include <iosfwd>
#include <memory>
#include <vector>

#include "common/fs_manager.h"
#include "common/gpid.h"
Expand Down
2 changes: 2 additions & 0 deletions 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 Down
1 change: 1 addition & 0 deletions src/replica/test/replica_disk_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <unistd.h>
#include <atomic>
#include <cstdint>
#include <map>
#include <memory>
Expand Down

0 comments on commit 0317989

Please sign in to comment.