diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a85cf2977..79cc43570a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,5 +4,6 @@ endif() add_subdirectory(core) add_subdirectory(aio) add_subdirectory(dist) +add_subdirectory(block_service) add_subdirectory(http) add_subdirectory(tests) diff --git a/src/dist/block_service/CMakeLists.txt b/src/block_service/CMakeLists.txt similarity index 100% rename from src/dist/block_service/CMakeLists.txt rename to src/block_service/CMakeLists.txt diff --git a/src/dist/block_service/block_service_manager.cpp b/src/block_service/block_service_manager.cpp similarity index 98% rename from src/dist/block_service/block_service_manager.cpp rename to src/block_service/block_service_manager.cpp index efa7066d87..5a506d7d94 100644 --- a/src/dist/block_service/block_service_manager.cpp +++ b/src/block_service/block_service_manager.cpp @@ -3,8 +3,8 @@ // can be found in the LICENSE file in the root directory of this source tree. #include "block_service_manager.h" -#include "fds/fds_service.h" -#include "local/local_service.h" +#include "block_service/fds/fds_service.h" +#include "block_service/local/local_service.h" #include #include diff --git a/src/dist/block_service/block_service_manager.h b/src/block_service/block_service_manager.h similarity index 100% rename from src/dist/block_service/block_service_manager.h rename to src/block_service/block_service_manager.h diff --git a/src/dist/block_service/fds/CMakeLists.txt b/src/block_service/fds/CMakeLists.txt similarity index 100% rename from src/dist/block_service/fds/CMakeLists.txt rename to src/block_service/fds/CMakeLists.txt diff --git a/src/dist/block_service/fds/fds_service.cpp b/src/block_service/fds/fds_service.cpp similarity index 100% rename from src/dist/block_service/fds/fds_service.cpp rename to src/block_service/fds/fds_service.cpp diff --git a/src/dist/block_service/fds/fds_service.h b/src/block_service/fds/fds_service.h similarity index 100% rename from src/dist/block_service/fds/fds_service.h rename to src/block_service/fds/fds_service.h diff --git a/src/dist/block_service/local/CMakeLists.txt b/src/block_service/local/CMakeLists.txt similarity index 100% rename from src/dist/block_service/local/CMakeLists.txt rename to src/block_service/local/CMakeLists.txt diff --git a/src/dist/block_service/local/local_service.cpp b/src/block_service/local/local_service.cpp similarity index 100% rename from src/dist/block_service/local/local_service.cpp rename to src/block_service/local/local_service.cpp diff --git a/src/dist/block_service/local/local_service.h b/src/block_service/local/local_service.h similarity index 100% rename from src/dist/block_service/local/local_service.h rename to src/block_service/local/local_service.h diff --git a/src/dist/block_service/test/CMakeLists.txt b/src/block_service/test/CMakeLists.txt similarity index 100% rename from src/dist/block_service/test/CMakeLists.txt rename to src/block_service/test/CMakeLists.txt diff --git a/src/dist/block_service/test/block_service_manager_test.cpp b/src/block_service/test/block_service_manager_test.cpp similarity index 98% rename from src/dist/block_service/test/block_service_manager_test.cpp rename to src/block_service/test/block_service_manager_test.cpp index 7272aa6ab1..2065849281 100644 --- a/src/dist/block_service/test/block_service_manager_test.cpp +++ b/src/block_service/test/block_service_manager_test.cpp @@ -3,7 +3,7 @@ // can be found in the LICENSE file in the root directory of this source tree. #include "block_service_mock.h" -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" #include diff --git a/src/dist/block_service/test/block_service_mock.h b/src/block_service/test/block_service_mock.h similarity index 99% rename from src/dist/block_service/test/block_service_mock.h rename to src/block_service/test/block_service_mock.h index 8a635bda72..dac70d70a6 100644 --- a/src/dist/block_service/test/block_service_mock.h +++ b/src/block_service/test/block_service_mock.h @@ -4,7 +4,7 @@ #pragma once -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" #include #include diff --git a/src/block_service/test/clear.sh b/src/block_service/test/clear.sh new file mode 100755 index 0000000000..dd6cc3c87e --- /dev/null +++ b/src/block_service/test/clear.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -rf log.* *.log data dsn_block_service_test.xml randomfile* diff --git a/src/dist/block_service/test/config-test.ini b/src/block_service/test/config-test.ini similarity index 83% rename from src/dist/block_service/test/config-test.ini rename to src/block_service/test/config-test.ini index aeb045c4fd..877bc221ed 100644 --- a/src/dist/block_service/test/config-test.ini +++ b/src/block_service/test/config-test.ini @@ -19,3 +19,9 @@ logging_factory_name = dsn::tools::simple_logger fast_flush = true short_header = false stderr_start_level = LOG_LEVEL_WARNING + +[fds_concurrent_test] +total_files = 64 +min_size = 100 +max_size = 150 + diff --git a/src/tests/dsn/fds_service_test.cpp b/src/block_service/test/fds_service_test.cpp similarity index 93% rename from src/tests/dsn/fds_service_test.cpp rename to src/block_service/test/fds_service_test.cpp index bebd607365..7f68b3ec5a 100644 --- a/src/tests/dsn/fds_service_test.cpp +++ b/src/block_service/test/fds_service_test.cpp @@ -6,7 +6,7 @@ #include #include -#include "dist/block_service/fds/fds_service.h" +#include "block_service/fds/fds_service.h" using namespace dsn; using namespace dsn::dist::block_service; @@ -876,69 +876,3 @@ TEST_F(FDSClientTest, test_concurrent_upload_download) } } } - -// TEST_F(FDSClientTest, test_max_file_size) -//{ -// char block[1024]; -// const char *str = "test_str"; -// for (int i = 0; i < 128; ++i) { -// memcpy(block + i * 8, str, 8); -// } -// -// std::shared_ptr _service = std::make_shared(); -// std::vector init_str = {server_address, access_key, access_secret, bucket_name}; -// -// if (server_address == example_server_address) { -// // user don't specify the server-address, we just return true -// return; -// } -// _service->initialize(init_str); -// -// create_file_response cf_resp; -// _service -// ->create_file(create_file_request{"upload_test", true}, -// lpc_btest, -// [&cf_resp](const create_file_response &r) { cf_resp = r; }, -// nullptr) -// ->wait(); -// -// ASSERT_EQ(dsn::ERR_OK, cf_resp.err); -// ASSERT_NE(nullptr, cf_resp.file_handle.get()); -// -// unsigned long prev_size = 32 * 1024; -// unsigned long new_size = prev_size * 2; -// unsigned long ceiling = 0; -// -// while (new_size > prev_size) { -// generate_file("test_local_file", new_size, block, 1024); -// upload_response u_resp; -// -// uint64_t start = dsn_now_ms(); -// cf_resp.file_handle -// ->upload(upload_request{"test_local_file"}, -// lpc_btest, -// [&u_resp](const upload_response &r) { u_resp = r; }, -// nullptr) -// ->wait(); -// uint64_t end = dsn_now_ms(); -// -// if (u_resp.err == dsn::ERR_OK && u_resp.uploaded_size == new_size) { -// printf("upload a file with size %lf MB succeed, time consume %lf sec\n", -// new_size / (1024.0 * 1024.0), -// (end - start) / 1000.0); -// if (ceiling == 0) { -// prev_size = new_size; -// new_size *= 2; -// } else { -// prev_size = new_size; -// new_size = (ceiling + prev_size) / 2; -// } -// } else { -// printf("upload a file with size %lf MB failed, time consume %lf sec\n", -// new_size / (1024.0 * 1024.0), -// (end - start) / 1000.0); -// ceiling = new_size; -// new_size = (ceiling + prev_size) / 2; -// } -// } -//} diff --git a/src/dist/block_service/test/main.cpp b/src/block_service/test/main.cpp similarity index 100% rename from src/dist/block_service/test/main.cpp rename to src/block_service/test/main.cpp diff --git a/src/dist/block_service/test/run.sh b/src/block_service/test/run.sh similarity index 94% rename from src/dist/block_service/test/run.sh rename to src/block_service/test/run.sh index 7cb92684ed..7f66a9ade7 100755 --- a/src/dist/block_service/test/run.sh +++ b/src/block_service/test/run.sh @@ -4,5 +4,6 @@ if [ -z "${REPORT_DIR}" ]; then REPORT_DIR="." fi +./clear.sh output_xml="${REPORT_DIR}/dsn_block_service_test.xml" GTEST_OUTPUT="xml:${output_xml}" ./dsn_block_service_test diff --git a/src/dist/CMakeLists.txt b/src/dist/CMakeLists.txt index 79f151ccf1..40b50afb96 100644 --- a/src/dist/CMakeLists.txt +++ b/src/dist/CMakeLists.txt @@ -1,6 +1,5 @@ add_subdirectory(failure_detector) add_subdirectory(replication) add_subdirectory(failure_detector_multimaster) -add_subdirectory(block_service) add_subdirectory(nfs) add_subdirectory(cmd) diff --git a/src/dist/replication/lib/replica_backup.cpp b/src/dist/replication/lib/replica_backup.cpp index 6fe486e274..fe3c1454f2 100644 --- a/src/dist/replication/lib/replica_backup.cpp +++ b/src/dist/replication/lib/replica_backup.cpp @@ -5,7 +5,7 @@ #include #include -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" #include "dist/replication/lib/backup/replica_backup_manager.h" #include "replica.h" diff --git a/src/dist/replication/lib/replica_context.cpp b/src/dist/replication/lib/replica_context.cpp index e84d1520dc..3437f4d014 100644 --- a/src/dist/replication/lib/replica_context.cpp +++ b/src/dist/replication/lib/replica_context.cpp @@ -41,7 +41,7 @@ #include "replica_stub.h" #include "mutation.h" #include "mutation_log.h" -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" namespace dsn { namespace replication { diff --git a/src/dist/replication/lib/replica_restore.cpp b/src/dist/replication/lib/replica_restore.cpp index b54a7f1758..29a72e8aca 100644 --- a/src/dist/replication/lib/replica_restore.cpp +++ b/src/dist/replication/lib/replica_restore.cpp @@ -12,7 +12,7 @@ #include "replica.h" #include "mutation_log.h" #include "replica_stub.h" -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" using namespace dsn::dist::block_service; diff --git a/src/dist/replication/lib/replica_stub.h b/src/dist/replication/lib/replica_stub.h index 1746c4b5de..ee67e3bffe 100644 --- a/src/dist/replication/lib/replica_stub.h +++ b/src/dist/replication/lib/replica_stub.h @@ -40,7 +40,7 @@ #include "dist/replication/common/replication_common.h" #include "dist/replication/common/fs_manager.h" -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" #include "replica.h" namespace dsn { diff --git a/src/dist/replication/meta_server/meta_backup_service.cpp b/src/dist/replication/meta_server/meta_backup_service.cpp index 00692baf80..9042b3d0fb 100644 --- a/src/dist/replication/meta_server/meta_backup_service.cpp +++ b/src/dist/replication/meta_server/meta_backup_service.cpp @@ -6,7 +6,7 @@ #include "meta_backup_service.h" #include "dist/replication/meta_server/meta_service.h" #include "dist/replication/meta_server/server_state.h" -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" namespace dsn { namespace replication { diff --git a/src/dist/replication/meta_server/meta_service.h b/src/dist/replication/meta_server/meta_service.h index 4c583ebbab..a0ddbd48db 100644 --- a/src/dist/replication/meta_server/meta_service.h +++ b/src/dist/replication/meta_server/meta_service.h @@ -45,7 +45,7 @@ #include "dist/replication/meta_server/meta_options.h" #include "dist/replication/meta_server/meta_backup_service.h" #include "dist/replication/meta_server/meta_state_service_utils.h" -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" namespace dsn { namespace replication { diff --git a/src/dist/replication/meta_server/server_state_restore.cpp b/src/dist/replication/meta_server/server_state_restore.cpp index 3414db9408..05442e2652 100644 --- a/src/dist/replication/meta_server/server_state_restore.cpp +++ b/src/dist/replication/meta_server/server_state_restore.cpp @@ -28,7 +28,7 @@ #include #include -#include "dist/block_service/block_service_manager.h" +#include "block_service/block_service_manager.h" #include "dist/replication/common/replication_common.h" #include "dist/replication/meta_server/meta_service.h" #include "dist/replication/meta_server/server_state.h" diff --git a/src/dist/replication/test/replica_test/unit_test/backup_block_service_mock.h b/src/dist/replication/test/replica_test/unit_test/backup_block_service_mock.h index 8286192716..49e3c70936 100644 --- a/src/dist/replication/test/replica_test/unit_test/backup_block_service_mock.h +++ b/src/dist/replication/test/replica_test/unit_test/backup_block_service_mock.h @@ -11,7 +11,7 @@ #include #include "dist/replication/lib/replica_context.h" #include "dist/replication/test/replica_test/unit_test/replication_service_test_app.h" -#include "dist/block_service/test/block_service_mock.h" +#include "block_service/test/block_service_mock.h" using namespace ::dsn; using namespace ::dsn::dist::block_service; diff --git a/src/tests/dsn/config-test.ini b/src/tests/dsn/config-test.ini index e0bbb6d013..7911cb676e 100644 --- a/src/tests/dsn/config-test.ini +++ b/src/tests/dsn/config-test.ini @@ -112,8 +112,3 @@ hosts_list = localhost:12181 timeout_ms = 30000 logfile = zoolog.log -[fds_concurrent_test] -total_files = 64 -min_size = 100 -max_size = 150 -