diff --git a/.github/workflows/lint_and_test_cpp.yaml b/.github/workflows/lint_and_test_cpp.yaml index 852c83c19bd..797aec29078 100644 --- a/.github/workflows/lint_and_test_cpp.yaml +++ b/.github/workflows/lint_and_test_cpp.yaml @@ -608,6 +608,7 @@ jobs: run: | ccache -p ccache -z + // TODO(yingchun): Append "-m dsn_utils_tests" to the command if not needed to pack server or tools, for example, the dependencies are static linked. ./run.sh build --test --skip_thirdparty -j $(nproc) -t release --use_jemalloc ccache -s - name: Clear Build Files diff --git a/.licenserc.yaml b/.licenserc.yaml index 1c58047590b..16b314fe2f1 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -162,7 +162,7 @@ header: - 'src/aio/file_io.h' - 'src/runtime/task/future_types.h' - 'src/runtime/global_config.h' - - 'src/common/gpid.h' + - 'src/utils/gpid.h' - 'src/runtime/rpc/group_address.h' - 'src/utils/logging_provider.h' - 'src/runtime/rpc/message_parser.h' diff --git a/cmake_modules/BaseFunctions.cmake b/cmake_modules/BaseFunctions.cmake index dc0e3b28f73..3dbfb1373c1 100644 --- a/cmake_modules/BaseFunctions.cmake +++ b/cmake_modules/BaseFunctions.cmake @@ -156,12 +156,6 @@ function(dsn_add_static_library) dsn_install_library() endfunction(dsn_add_static_library) -function(dsn_add_shared_library) - set(MY_PROJ_TYPE "SHARED") - dsn_add_project() - dsn_install_library() -endfunction(dsn_add_shared_library) - function(dsn_add_executable) set(MY_PROJ_TYPE "EXECUTABLE") dsn_add_project() diff --git a/src/aio/CMakeLists.txt b/src/aio/CMakeLists.txt index 3a27fbe01ae..4db5b0d4c4d 100644 --- a/src/aio/CMakeLists.txt +++ b/src/aio/CMakeLists.txt @@ -35,6 +35,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + sasl2 + gssapi_krb5 + krb5 rocksdb lz4 zstd diff --git a/src/aio/test/CMakeLists.txt b/src/aio/test/CMakeLists.txt index 2eb43714676..b8099536c2a 100644 --- a/src/aio/test/CMakeLists.txt +++ b/src/aio/test/CMakeLists.txt @@ -38,8 +38,12 @@ set(MY_PROJ_LIBS dsn_replication_common gtest dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_aio test_utils + dsn_utils rocksdb lz4 zstd diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 7c117ef4f19..54b78b23455 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "pegasus_base") +set(MY_PROJ_NAME pegasus_base) if(UNIX) add_compile_options(-fPIC) diff --git a/src/base/test/CMakeLists.txt b/src/base/test/CMakeLists.txt index b7e1c29d0e9..7fae9d7d820 100644 --- a/src/base/test/CMakeLists.txt +++ b/src/base/test/CMakeLists.txt @@ -28,10 +28,13 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_runtime - dsn_utils - pegasus_base - gtest) + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_utils + pegasus_base + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/block_service/block_service.h b/src/block_service/block_service.h index d351dcf44ae..1f4b17b2131 100644 --- a/src/block_service/block_service.h +++ b/src/block_service/block_service.h @@ -28,7 +28,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" #include "runtime/serverlet.h" diff --git a/src/block_service/test/CMakeLists.txt b/src/block_service/test/CMakeLists.txt index b8aaad6520a..70a5534df2b 100644 --- a/src/block_service/test/CMakeLists.txt +++ b/src/block_service/test/CMakeLists.txt @@ -27,6 +27,9 @@ set(MY_PROJ_LIBS dsn.block_service.local dsn.block_service.hdfs dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils gtest gtest_main diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 21134b3f4cc..00279e10858 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -33,7 +33,9 @@ set(MY_PROJ_SRC "") # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS "") +set(MY_PROJ_LIBS + dsn_utils + dsn_replication_common) # Extra files that will be installed set(MY_BINPLACES "") diff --git a/src/client/partition_resolver.h b/src/client/partition_resolver.h index b870b2c7a2e..276c101982c 100644 --- a/src/client/partition_resolver.h +++ b/src/client/partition_resolver.h @@ -33,7 +33,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" #include "runtime/rpc/serialization.h" diff --git a/src/client/partition_resolver_simple.cpp b/src/client/partition_resolver_simple.cpp index a0fd30224d0..32c31d5b257 100644 --- a/src/client/partition_resolver_simple.cpp +++ b/src/client/partition_resolver_simple.cpp @@ -31,7 +31,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "partition_resolver_simple.h" #include "runtime/api_layer1.h" diff --git a/src/client/replication_ddl_client.cpp b/src/client/replication_ddl_client.cpp index e086613050c..66d1727c3f8 100644 --- a/src/client/replication_ddl_client.cpp +++ b/src/client/replication_ddl_client.cpp @@ -38,7 +38,7 @@ #include "backup_types.h" #include "common//duplication_common.h" #include "common/bulk_load_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/manual_compact.h" #include "common/partition_split_common.h" #include "common/replication.codes.h" @@ -513,8 +513,9 @@ std::string host_name_resolve(bool resolve_ip, std::string value) { if (resolve_ip) { std::string temp; - if (dsn::utils::hostname_from_ip_port(value.c_str(), &temp)) + if (dsn::utils::hostname_from_ip_port(value.c_str(), &temp)) { return temp; + } } return value; } diff --git a/src/client/test/CMakeLists.txt b/src/client/test/CMakeLists.txt index 60f37627602..c0a5d0430a7 100644 --- a/src/client/test/CMakeLists.txt +++ b/src/client/test/CMakeLists.txt @@ -25,6 +25,9 @@ set(MY_PROJ_LIBS dsn_client dsn_replication_common dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils gtest rocksdb diff --git a/src/client_lib/CMakeLists.txt b/src/client_lib/CMakeLists.txt index 0bc95bfb517..52537c57965 100644 --- a/src/client_lib/CMakeLists.txt +++ b/src/client_lib/CMakeLists.txt @@ -16,7 +16,7 @@ # under the License. # TODO(yingchun): should export shared lib too!!! -set(MY_PROJ_NAME "pegasus_client_static") +set(MY_PROJ_NAME pegasus_client_static) add_definitions(-fPIC) diff --git a/src/client_lib/pegasus_scanner_impl.cpp b/src/client_lib/pegasus_scanner_impl.cpp index d161a541f2e..92c07095e6b 100644 --- a/src/client_lib/pegasus_scanner_impl.cpp +++ b/src/client_lib/pegasus_scanner_impl.cpp @@ -28,7 +28,7 @@ #include #include "base/pegasus_const.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "pegasus/client.h" #include "pegasus/error.h" #include "pegasus_client_impl.h" diff --git a/src/common/backup_common.cpp b/src/common/backup_common.cpp index 0d58b8bf02c..17ae8cfc02b 100644 --- a/src/common/backup_common.cpp +++ b/src/common/backup_common.cpp @@ -17,7 +17,7 @@ #include "backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/api_layer1.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/common/fs_manager.cpp b/src/common/fs_manager.cpp index 88b1da66039..25d566c97da 100644 --- a/src/common/fs_manager.cpp +++ b/src/common/fs_manager.cpp @@ -33,7 +33,7 @@ #include #include "absl/strings/string_view.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_enums.h" #include "fmt/core.h" #include "replica_admin_types.h" diff --git a/src/common/json_helper.h b/src/common/json_helper.h index 3c5bed8eab1..21a841c605c 100644 --- a/src/common/json_helper.h +++ b/src/common/json_helper.h @@ -50,7 +50,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "meta_admin_types.h" #include "partition_split_types.h" #include "duplication_types.h" diff --git a/src/common/replication.codes.h b/src/common/replication.codes.h index a542e581309..f92b59e43c1 100644 --- a/src/common/replication.codes.h +++ b/src/common/replication.codes.h @@ -29,7 +29,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" DEFINE_THREAD_POOL_CODE(THREAD_POOL_META_SERVER) DEFINE_THREAD_POOL_CODE(THREAD_POOL_META_STATE) diff --git a/src/common/replication_common.cpp b/src/common/replication_common.cpp index a54d4bbfd20..aa2af1a4db5 100644 --- a/src/common/replication_common.cpp +++ b/src/common/replication_common.cpp @@ -33,7 +33,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replica_envs.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" diff --git a/src/common/storage_serverlet.h b/src/common/storage_serverlet.h index ee1ef3bee24..33ac1929eed 100644 --- a/src/common/storage_serverlet.h +++ b/src/common/storage_serverlet.h @@ -39,7 +39,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" #include "runtime/serverlet.h" diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index fab09262493..72c1cb1acb5 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -30,6 +30,10 @@ set(MY_PROJ_LIBS dsn_http dsn_replication_common dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_utils gtest rocksdb lz4 diff --git a/src/common/test/fs_manager_test.cpp b/src/common/test/fs_manager_test.cpp index 2e67dd85f92..808b704fb99 100644 --- a/src/common/test/fs_manager_test.cpp +++ b/src/common/test/fs_manager_test.cpp @@ -26,7 +26,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "gtest/gtest.h" #include "metadata_types.h" diff --git a/src/failure_detector/fd.code.definition.h b/src/failure_detector/fd.code.definition.h index 1f8934aaee4..7f7d96dfd3f 100644 --- a/src/failure_detector/fd.code.definition.h +++ b/src/failure_detector/fd.code.definition.h @@ -34,7 +34,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" #include "runtime/serverlet.h" diff --git a/src/failure_detector/test/CMakeLists.txt b/src/failure_detector/test/CMakeLists.txt index 5b5a6832a95..e79b20009f6 100644 --- a/src/failure_detector/test/CMakeLists.txt +++ b/src/failure_detector/test/CMakeLists.txt @@ -34,13 +34,27 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_runtime dsn_meta_server + dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_replica_server + dsn.security + dsn_nfs + dsn_aio + dsn_dist_cmd dsn_replication_common + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local dsn.failure_detector - gtest + dsn.replication.zookeeper_provider + zookeeper hashtable + dsn_utils + gtest + test_utils rocksdb lz4 zstd diff --git a/src/geo/bench/CMakeLists.txt b/src/geo/bench/CMakeLists.txt index 559747b59de..46014557237 100644 --- a/src/geo/bench/CMakeLists.txt +++ b/src/geo/bench/CMakeLists.txt @@ -28,17 +28,25 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + pegasus_geo_lib + pegasus_client_static + dsn_client + dsn_utils + dsn_http + dsn_replication_common absl::flat_hash_set absl::strings - pegasus_geo_lib s2testing s2 - pegasus_client_static + thrift rocksdb lz4 zstd - snappy - dsn_utils) + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/geo/lib/CMakeLists.txt b/src/geo/lib/CMakeLists.txt index 094bfb352c2..420bb248447 100644 --- a/src/geo/lib/CMakeLists.txt +++ b/src/geo/lib/CMakeLists.txt @@ -27,10 +27,9 @@ set(MY_PROJ_SRC "") # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS "" - # s2 - # pegasus_client_static - ) +set(MY_PROJ_LIBS + s2 + pegasus_client_static) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/geo/test/CMakeLists.txt b/src/geo/test/CMakeLists.txt index e29d506ae1e..3cf968a6920 100644 --- a/src/geo/test/CMakeLists.txt +++ b/src/geo/test/CMakeLists.txt @@ -28,12 +28,17 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS + dsn_runtime + sasl2 + gssapi_krb5 + krb5 absl::flat_hash_set absl::strings pegasus_geo_lib s2testing s2 pegasus_client_static + dsn_client dsn_utils gtest) diff --git a/src/http/CMakeLists.txt b/src/http/CMakeLists.txt index 44f93796d84..56c8f4fc676 100644 --- a/src/http/CMakeLists.txt +++ b/src/http/CMakeLists.txt @@ -21,7 +21,8 @@ set(MY_PROJ_SRC ${THIRDPARTY_ROOT}/build/Source/http-parser/http_parser.c) set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS "") +set(MY_PROJ_LIBS + dsn_replication_common) dsn_add_static_library() diff --git a/src/http/http_server.h b/src/http/http_server.h index 5ae780b9835..3839dd780be 100644 --- a/src/http/http_server.h +++ b/src/http/http_server.h @@ -113,12 +113,13 @@ class http_server_base : public http_service { static std::once_flag flag; std::call_once(flag, [&]() { - register_handler("updateConfig", - std::bind(&http_server_base::update_config_handler, - this, - std::placeholders::_1, - std::placeholders::_2), - "ip:port/updateConfig?="); + // undefined reference to `dsn::http_server_base::update_config_handler + // register_handler("updateConfig", + // std::bind(&http_server_base::update_config_handler, + // this, + // std::placeholders::_1, + // std::placeholders::_2), + // "ip:port/updateConfig?="); }); } diff --git a/src/http/test/CMakeLists.txt b/src/http/test/CMakeLists.txt index 4400c0183f7..9b2d9ad8ca0 100644 --- a/src/http/test/CMakeLists.txt +++ b/src/http/test/CMakeLists.txt @@ -24,12 +24,16 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_utils curl gtest rocksdb lz4 - zstd - snappy) + snappy + zstd) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index fcc3a123296..2da36453149 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -43,6 +43,12 @@ set(MY_PROJ_LIBS dsn_dist_cmd dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_ranger + dsn.security + dsn.task dsn_aio zookeeper hashtable @@ -59,6 +65,6 @@ set(MY_BINPLACES "") add_definitions(-DDSN_MOCK_TEST) -dsn_add_shared_library() +dsn_add_static_library() add_subdirectory(test) diff --git a/src/meta/app_balance_policy.cpp b/src/meta/app_balance_policy.cpp index 972f8ba5a1d..6d1f17be751 100644 --- a/src/meta/app_balance_policy.cpp +++ b/src/meta/app_balance_policy.cpp @@ -23,7 +23,7 @@ #include #include "app_balance_policy.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "meta/load_balance_policy.h" #include "metadata_types.h" #include "utils/flags.h" diff --git a/src/meta/backup_engine.cpp b/src/meta/backup_engine.cpp index c7d3769ce05..18db0863972 100644 --- a/src/meta/backup_engine.cpp +++ b/src/meta/backup_engine.cpp @@ -27,7 +27,7 @@ #include "block_service/block_service.h" #include "block_service/block_service_manager.h" #include "common/backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" diff --git a/src/meta/cluster_balance_policy.h b/src/meta/cluster_balance_policy.h index 474935d8979..678beab8698 100644 --- a/src/meta/cluster_balance_policy.h +++ b/src/meta/cluster_balance_policy.h @@ -28,7 +28,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "load_balance_policy.h" #include "meta/meta_data.h" #include "metadata_types.h" diff --git a/src/meta/dump_file.h b/src/meta/dump_file.h index 062ffd1fccb..222b4d44535 100644 --- a/src/meta/dump_file.h +++ b/src/meta/dump_file.h @@ -38,7 +38,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" #include "runtime/serverlet.h" diff --git a/src/meta/duplication/meta_duplication_service.cpp b/src/meta/duplication/meta_duplication_service.cpp index fd1d034f176..7096d24e8d1 100644 --- a/src/meta/duplication/meta_duplication_service.cpp +++ b/src/meta/duplication/meta_duplication_service.cpp @@ -23,7 +23,7 @@ #include "common//duplication_common.h" #include "common/common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" diff --git a/src/meta/load_balance_policy.h b/src/meta/load_balance_policy.h index f0e06bf0b60..700c561aea1 100644 --- a/src/meta/load_balance_policy.h +++ b/src/meta/load_balance_policy.h @@ -30,7 +30,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "meta_data.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/meta_backup_service.h b/src/meta/meta_backup_service.h index e382a8922cd..03970df72c0 100644 --- a/src/meta/meta_backup_service.h +++ b/src/meta/meta_backup_service.h @@ -33,7 +33,7 @@ #include #include "backup_types.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication_other_types.h" #include "meta_rpc_types.h" diff --git a/src/meta/meta_bulk_load_ingestion_context.h b/src/meta/meta_bulk_load_ingestion_context.h index 50e7872d5f7..bf31a2954f4 100644 --- a/src/meta/meta_bulk_load_ingestion_context.h +++ b/src/meta/meta_bulk_load_ingestion_context.h @@ -21,7 +21,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/rpc_address.h" #include "utils/flags.h" diff --git a/src/meta/meta_bulk_load_service.h b/src/meta/meta_bulk_load_service.h index c411d87f447..a138b36be43 100644 --- a/src/meta/meta_bulk_load_service.h +++ b/src/meta/meta_bulk_load_service.h @@ -30,7 +30,7 @@ #include "bulk_load_types.h" #include "common/bulk_load_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication_other_types.h" #include "meta/meta_state_service_utils.h" diff --git a/src/meta/meta_data.cpp b/src/meta/meta_data.cpp index a44180d4a09..2da8f3f3bca 100644 --- a/src/meta/meta_data.cpp +++ b/src/meta/meta_data.cpp @@ -27,7 +27,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_enums.h" #include "meta_data.h" #include "runtime/api_layer1.h" diff --git a/src/meta/meta_data.h b/src/meta/meta_data.h index ea236fa5cc1..75469896ea3 100644 --- a/src/meta/meta_data.h +++ b/src/meta/meta_data.h @@ -39,7 +39,7 @@ #include #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" diff --git a/src/meta/meta_http_service.cpp b/src/meta/meta_http_service.cpp index 902822d79fd..e6f2be151cb 100644 --- a/src/meta/meta_http_service.cpp +++ b/src/meta/meta_http_service.cpp @@ -30,7 +30,7 @@ #include "bulk_load_types.h" #include "common//duplication_common.h" #include "common/bulk_load_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replica_envs.h" #include "common/replication.codes.h" #include "common/replication_common.h" diff --git a/src/meta/meta_options.cpp b/src/meta/meta_options.cpp index 7956ff35e23..c813c3a9971 100644 --- a/src/meta/meta_options.cpp +++ b/src/meta/meta_options.cpp @@ -55,18 +55,6 @@ DSN_DEFINE_string(meta_server, "", "white list of replica-servers in meta-server"); -std::string meta_options::concat_path_unix_style(const std::string &prefix, - const std::string &postfix) -{ - size_t pos1 = prefix.size(); // last_valid_pos + 1 - while (pos1 > 0 && prefix[pos1 - 1] == '/') - pos1--; - size_t pos2 = 0; // first non '/' position - while (pos2 < postfix.size() && postfix[pos2] == '/') - pos2++; - return prefix.substr(0, pos1) + "/" + postfix.substr(pos2); -} - void meta_options::initialize() { utils::split_args(FLAGS_meta_state_service_parameters, meta_state_service_args); diff --git a/src/meta/meta_options.h b/src/meta/meta_options.h index f33d83174e5..ffda22eae52 100644 --- a/src/meta/meta_options.h +++ b/src/meta/meta_options.h @@ -54,10 +54,6 @@ class meta_options public: void initialize(); - -public: - static std::string concat_path_unix_style(const std::string &prefix, - const std::string &postfix); }; } // namespace replication } // namespace dsn diff --git a/src/meta/meta_service.cpp b/src/meta/meta_service.cpp index c35e3be99f2..e9c55aa76bb 100644 --- a/src/meta/meta_service.cpp +++ b/src/meta/meta_service.cpp @@ -38,7 +38,7 @@ #include "backup_types.h" #include "bulk_load_types.h" #include "common/common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" #include "duplication_types.h" @@ -64,6 +64,7 @@ #include "utils/autoref_ptr.h" #include "utils/command_manager.h" #include "utils/factory_store.h" +#include "utils/filesystem.h" #include "utils/flags.h" #include "utils/fmt_logging.h" #include "utils/string_conv.h" @@ -224,7 +225,7 @@ error_code meta_service::remote_storage_initialize() utils::split_args(FLAGS_cluster_root, slices, '/'); std::string current = ""; for (unsigned int i = 0; i != slices.size(); ++i) { - current = meta_options::concat_path_unix_style(current, slices[i]); + current = dsn::utils::filesystem::concat_path_unix_style(current, slices[i]); task_ptr tsk = _storage->create_node(current, LPC_META_CALLBACK, [&err](error_code ec) { err = ec; }); tsk->wait(); @@ -445,16 +446,16 @@ error_code meta_service::start() LOG_INFO("initialize backup handler"); _backup_handler = std::make_shared( this, - meta_options::concat_path_unix_style(_cluster_root, "backup"), + dsn::utils::filesystem::concat_path_unix_style(_cluster_root, "backup"), FLAGS_cold_backup_root, [](backup_service *bs) { return std::make_shared(bs); }); } _bulk_load_svc = std::make_unique( - this, meta_options::concat_path_unix_style(_cluster_root, "bulk_load")); + this, dsn::utils::filesystem::concat_path_unix_style(_cluster_root, "bulk_load")); // initialize the server_state - _state->initialize(this, meta_options::concat_path_unix_style(_cluster_root, "apps")); + _state->initialize(this, dsn::utils::filesystem::concat_path_unix_style(_cluster_root, "apps")); while ((err = _state->initialize_data_structure()) != ERR_OK) { if (err == ERR_OBJECT_NOT_FOUND && FLAGS_recover_from_replica_server) { LOG_INFO("can't find apps from remote storage, and " diff --git a/src/meta/meta_split_service.cpp b/src/meta/meta_split_service.cpp index 33610fc6a4c..23ac7fbab56 100644 --- a/src/meta/meta_split_service.cpp +++ b/src/meta/meta_split_service.cpp @@ -24,7 +24,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replica_envs.h" #include "common/replication.codes.h" diff --git a/src/meta/partition_guardian.h b/src/meta/partition_guardian.h index 9c77da7e52d..f43c02bc53d 100644 --- a/src/meta/partition_guardian.h +++ b/src/meta/partition_guardian.h @@ -25,7 +25,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "meta_admin_types.h" #include "meta_data.h" diff --git a/src/meta/server_load_balancer.cpp b/src/meta/server_load_balancer.cpp index 04b53f67204..9c7862ff2f5 100644 --- a/src/meta/server_load_balancer.cpp +++ b/src/meta/server_load_balancer.cpp @@ -28,7 +28,7 @@ #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "meta/meta_data.h" #include "meta_admin_types.h" diff --git a/src/meta/server_state.h b/src/meta/server_state.h index e8c1c4f0703..00be470abe4 100644 --- a/src/meta/server_state.h +++ b/src/meta/server_state.h @@ -38,7 +38,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/manual_compact.h" #include "dsn.layer2_types.h" #include "meta/meta_rpc_types.h" diff --git a/src/meta/server_state_restore.cpp b/src/meta/server_state_restore.cpp index b2dada4a25e..9b45b6f8906 100644 --- a/src/meta/server_state_restore.cpp +++ b/src/meta/server_state_restore.cpp @@ -31,7 +31,7 @@ #include "block_service/block_service.h" #include "block_service/block_service_manager.h" #include "common/backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" diff --git a/src/meta/table_metrics.h b/src/meta/table_metrics.h index cec35e64b8a..c4ad6d66784 100644 --- a/src/meta/table_metrics.h +++ b/src/meta/table_metrics.h @@ -23,7 +23,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "utils/autoref_ptr.h" #include "utils/fmt_logging.h" #include "utils/metrics.h" diff --git a/src/meta/test/CMakeLists.txt b/src/meta/test/CMakeLists.txt index 49c9e4994d9..fad8c704984 100644 --- a/src/meta/test/CMakeLists.txt +++ b/src/meta/test/CMakeLists.txt @@ -38,21 +38,29 @@ set(MY_PROJ_SRC ${MY_PROJ_SRC} misc/misc.cpp) set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn.replication.zookeeper_provider + dsn_meta_server + dsn_dist_cmd dsn_replication_common + dsn.replication.zookeeper_provider + zookeeper + hashtable dsn.block_service - dsn.block_service.local dsn.block_service.hdfs + hdfs + dsn.block_service.local dsn.failure_detector - dsn_dist_cmd + dsn_aio dsn_http - dsn_meta_server dsn_runtime - dsn_aio - zookeeper - hashtable + dsn_utils + sasl2 + gssapi_krb5 + krb5 gtest - hdfs) + rocksdb + lz4 + zstd + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/meta/test/backup_test.cpp b/src/meta/test/backup_test.cpp index b27ba499587..aab0d141a2a 100644 --- a/src/meta/test/backup_test.cpp +++ b/src/meta/test/backup_test.cpp @@ -30,7 +30,7 @@ #include #include "backup_types.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" diff --git a/src/meta/test/balancer_simulator/CMakeLists.txt b/src/meta/test/balancer_simulator/CMakeLists.txt index 7fe9925dac4..3afac77775c 100644 --- a/src/meta/test/balancer_simulator/CMakeLists.txt +++ b/src/meta/test/balancer_simulator/CMakeLists.txt @@ -34,11 +34,26 @@ set(MY_PROJ_SRC ../misc/misc.cpp) set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_meta_server - dsn_replication_common - dsn_runtime - hashtable - gtest) + dsn_meta_server + dsn_dist_cmd + dsn_replication_common + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + dsn.failure_detector + dsn.replication.zookeeper_provider + zookeeper + hashtable + dsn_runtime + dsn_utils + sasl2 + gssapi_krb5 + krb5 + gtest + rocksdb + lz4 + zstd + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/meta/test/cluster_balance_policy_test.cpp b/src/meta/test/cluster_balance_policy_test.cpp index 0ade35a6c95..0c459e4baaa 100644 --- a/src/meta/test/cluster_balance_policy_test.cpp +++ b/src/meta/test/cluster_balance_policy_test.cpp @@ -27,7 +27,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" #include "meta/cluster_balance_policy.h" diff --git a/src/meta/test/copy_replica_operation_test.cpp b/src/meta/test/copy_replica_operation_test.cpp index c2f681fd322..439cf173b3d 100644 --- a/src/meta/test/copy_replica_operation_test.cpp +++ b/src/meta/test/copy_replica_operation_test.cpp @@ -24,7 +24,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" #include "meta/app_balance_policy.h" diff --git a/src/meta/test/ford_fulkerson_test.cpp b/src/meta/test/ford_fulkerson_test.cpp index 00b49d9beed..15e4598d6f1 100644 --- a/src/meta/test/ford_fulkerson_test.cpp +++ b/src/meta/test/ford_fulkerson_test.cpp @@ -21,7 +21,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" #include "meta/load_balance_policy.h" diff --git a/src/meta/test/meta_app_operation_test.cpp b/src/meta/test/meta_app_operation_test.cpp index a6f3cce2c1b..db9233ff8b8 100644 --- a/src/meta/test/meta_app_operation_test.cpp +++ b/src/meta/test/meta_app_operation_test.cpp @@ -26,7 +26,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replica_envs.h" #include "common/replication.codes.h" diff --git a/src/meta/test/meta_backup_test.cpp b/src/meta/test/meta_backup_test.cpp index da74bc7bfbb..4768237377d 100644 --- a/src/meta/test/meta_backup_test.cpp +++ b/src/meta/test/meta_backup_test.cpp @@ -24,7 +24,7 @@ #include "backup_types.h" #include "common/backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "gtest/gtest.h" #include "meta/backup_engine.h" diff --git a/src/meta/test/meta_bulk_load_ingestion_test.cpp b/src/meta/test/meta_bulk_load_ingestion_test.cpp index 73bb93ae608..38463af0249 100644 --- a/src/meta/test/meta_bulk_load_ingestion_test.cpp +++ b/src/meta/test/meta_bulk_load_ingestion_test.cpp @@ -21,7 +21,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" #include "meta/meta_bulk_load_ingestion_context.h" diff --git a/src/meta/test/meta_bulk_load_service_test.cpp b/src/meta/test/meta_bulk_load_service_test.cpp index c83f8cbbb4d..da7957f9a7b 100644 --- a/src/meta/test/meta_bulk_load_service_test.cpp +++ b/src/meta/test/meta_bulk_load_service_test.cpp @@ -31,7 +31,7 @@ #include "bulk_load_types.h" #include "common/bulk_load_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replica_envs.h" #include "common/replication.codes.h" @@ -54,6 +54,7 @@ #include "utils/blob.h" #include "utils/error_code.h" #include "utils/fail_point.h" +#include "utils/filesystem.h" #include "utils/fmt_logging.h" namespace dsn { @@ -344,7 +345,8 @@ class bulk_load_service_test : public meta_test_base // initialize bulk load service _ms->_bulk_load_svc = std::make_unique( - _ms.get(), meta_options::concat_path_unix_style(_ms->_cluster_root, "bulk_load")); + _ms.get(), + dsn::utils::filesystem::concat_path_unix_style(_ms->_cluster_root, "bulk_load")); mock_bulk_load_on_remote_storage( app_id_set, app_bulk_load_info_map, partition_bulk_load_info_map); diff --git a/src/meta/test/meta_data.cpp b/src/meta/test/meta_data.cpp index 16bcf7f1c49..2587922d74c 100644 --- a/src/meta/test/meta_data.cpp +++ b/src/meta/test/meta_data.cpp @@ -29,7 +29,7 @@ #include #include "client/partition_resolver.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" #include "meta/meta_data.h" diff --git a/src/meta/test/meta_duplication_service_test.cpp b/src/meta/test/meta_duplication_service_test.cpp index 2e222d0b7af..689804d443e 100644 --- a/src/meta/test/meta_duplication_service_test.cpp +++ b/src/meta/test/meta_duplication_service_test.cpp @@ -40,7 +40,7 @@ #include "common/common.h" #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" diff --git a/src/meta/test/meta_http_service_test.cpp b/src/meta/test/meta_http_service_test.cpp index cc2497ea8a5..39ec24057ed 100644 --- a/src/meta/test/meta_http_service_test.cpp +++ b/src/meta/test/meta_http_service_test.cpp @@ -26,7 +26,7 @@ #include "backup_types.h" #include "bulk_load_types.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "gtest/gtest.h" #include "http/http_server.h" diff --git a/src/meta/test/meta_partition_guardian_test.cpp b/src/meta/test/meta_partition_guardian_test.cpp index 403dcb3fe2b..1fa3669c6d3 100644 --- a/src/meta/test/meta_partition_guardian_test.cpp +++ b/src/meta/test/meta_partition_guardian_test.cpp @@ -37,7 +37,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" @@ -62,6 +62,7 @@ #include "runtime/task/task.h" #include "utils/autoref_ptr.h" #include "utils/error_code.h" +#include "utils/filesystem.h" namespace dsn { namespace replication { @@ -179,7 +180,8 @@ void meta_partition_guardian_test::cure_test() svc->_balancer.reset(new dummy_balancer(svc.get())); server_state *state = svc->_state.get(); - state->initialize(svc.get(), meta_options::concat_path_unix_style(svc->_cluster_root, "apps")); + state->initialize(svc.get(), + dsn::utils::filesystem::concat_path_unix_style(svc->_cluster_root, "apps")); dsn::app_info info; info.is_stateful = true; info.status = dsn::app_status::AS_CREATING; diff --git a/src/meta/test/meta_service_test_app.h b/src/meta/test/meta_service_test_app.h index b7557559197..9c067defca5 100644 --- a/src/meta/test/meta_service_test_app.h +++ b/src/meta/test/meta_service_test_app.h @@ -35,7 +35,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" #include "runtime/serverlet.h" diff --git a/src/meta/test/meta_split_service_test.cpp b/src/meta/test/meta_split_service_test.cpp index 12cb81e2033..dcd9fcfd6a7 100644 --- a/src/meta/test/meta_split_service_test.cpp +++ b/src/meta/test/meta_split_service_test.cpp @@ -38,7 +38,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/partition_split_common.h" #include "common/replica_envs.h" diff --git a/src/meta/test/meta_state/CMakeLists.txt b/src/meta/test/meta_state/CMakeLists.txt index 9f480e78082..b0fce629aa6 100644 --- a/src/meta/test/meta_state/CMakeLists.txt +++ b/src/meta/test/meta_state/CMakeLists.txt @@ -33,14 +33,24 @@ set(MY_PROJ_SRC "") # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS - dsn_meta_server - dsn_replica_server - dsn_replication_common - dsn_runtime - hashtable - gtest - ) +set(MY_PROJ_LIBS + dsn_meta_server + dsn_aio + dsn_replica_server + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_utils + gtest + zookeeper + hashtable + dsn.replication.zookeeper_provider + rocksdb + lz4 + snappy + zstd) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/meta/test/meta_test_base.cpp b/src/meta/test/meta_test_base.cpp index d05d8a1452e..3461b15f0f9 100644 --- a/src/meta/test/meta_test_base.cpp +++ b/src/meta/test/meta_test_base.cpp @@ -44,6 +44,7 @@ #include "runtime/task/task_tracker.h" #include "utils/error_code.h" #include "utils/factory_store.h" +#include "utils/filesystem.h" #include "utils/flags.h" #include "utils/fmt_logging.h" #include "utils/zlocks.h" @@ -71,7 +72,7 @@ void meta_test_base::SetUp() _ms->_split_svc = std::make_unique(_ms.get()); ASSERT_TRUE(_ms->_split_svc); _ms->_bulk_load_svc = std::make_unique( - _ms.get(), meta_options::concat_path_unix_style(_ms->_cluster_root, "bulk_load")); + _ms.get(), dsn::utils::filesystem::concat_path_unix_style(_ms->_cluster_root, "bulk_load")); ASSERT_TRUE(_ms->_bulk_load_svc); _ms->_bulk_load_svc->initialize_bulk_load_service(); diff --git a/src/meta/test/misc/misc.cpp b/src/meta/test/misc/misc.cpp index 25c16d67576..b83378901c0 100644 --- a/src/meta/test/misc/misc.cpp +++ b/src/meta/test/misc/misc.cpp @@ -40,7 +40,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_enums.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" diff --git a/src/meta/test/state_sync_test.cpp b/src/meta/test/state_sync_test.cpp index ccd83ee7443..e64ec2fe97c 100644 --- a/src/meta/test/state_sync_test.cpp +++ b/src/meta/test/state_sync_test.cpp @@ -35,7 +35,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" diff --git a/src/meta/test/update_configuration_test.cpp b/src/meta/test/update_configuration_test.cpp index d80b32a3e28..7c78e67866c 100644 --- a/src/meta/test/update_configuration_test.cpp +++ b/src/meta/test/update_configuration_test.cpp @@ -37,7 +37,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" @@ -63,6 +63,7 @@ #include "runtime/task/task.h" #include "utils/autoref_ptr.h" #include "utils/error_code.h" +#include "utils/filesystem.h" #include "utils/flags.h" #include "utils/fmt_logging.h" #include "utils/zlocks.h" @@ -224,7 +225,8 @@ void meta_service_test_app::update_configuration_test() svc->_balancer.reset(new dummy_balancer(svc.get())); server_state *ss = svc->_state.get(); - ss->initialize(svc.get(), meta_options::concat_path_unix_style(svc->_cluster_root, "apps")); + ss->initialize(svc.get(), + dsn::utils::filesystem::concat_path_unix_style(svc->_cluster_root, "apps")); dsn::app_info info; info.is_stateful = true; info.status = dsn::app_status::AS_CREATING; @@ -303,7 +305,8 @@ void meta_service_test_app::adjust_dropped_size() svc->_balancer.reset(new dummy_balancer(svc.get())); server_state *ss = svc->_state.get(); - ss->initialize(svc.get(), meta_options::concat_path_unix_style(svc->_cluster_root, "apps")); + ss->initialize(svc.get(), + dsn::utils::filesystem::concat_path_unix_style(svc->_cluster_root, "apps")); dsn::app_info info; info.is_stateful = true; info.status = dsn::app_status::AS_CREATING; diff --git a/src/nfs/nfs_node.h b/src/nfs/nfs_node.h index 635562c6694..5d0eff0351b 100644 --- a/src/nfs/nfs_node.h +++ b/src/nfs/nfs_node.h @@ -31,7 +31,7 @@ #include #include "aio/aio_task.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/api_task.h" #include "runtime/rpc/rpc_address.h" #include "runtime/task/task_code.h" diff --git a/src/nfs/test/CMakeLists.txt b/src/nfs/test/CMakeLists.txt index 4a22ce48677..a1e73bf622c 100644 --- a/src/nfs/test/CMakeLists.txt +++ b/src/nfs/test/CMakeLists.txt @@ -35,15 +35,19 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_nfs + dsn_http dsn_runtime - gtest dsn_aio - dsn_http + dsn_utils + sasl2 + gssapi_krb5 + krb5 + test_utils + gtest rocksdb lz4 zstd - snappy - test_utils) + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/nfs/test/main.cpp b/src/nfs/test/main.cpp index 49ededed032..cc28f4d48d1 100644 --- a/src/nfs/test/main.cpp +++ b/src/nfs/test/main.cpp @@ -34,7 +34,7 @@ #include #include "aio/aio_task.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "gtest/gtest.h" #include "nfs/nfs_node.h" #include "runtime/app_model.h" diff --git a/src/perf_counter/test/CMakeLists.txt b/src/perf_counter/test/CMakeLists.txt index f924437dec1..0c7f9ef8e17 100644 --- a/src/perf_counter/test/CMakeLists.txt +++ b/src/perf_counter/test/CMakeLists.txt @@ -36,8 +36,13 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_meta_server dsn_replication_common - gtest dsn_runtime + dsn_aio + dsn_utils + sasl2 + gssapi_krb5 + krb5 + gtest rocksdb lz4 zstd diff --git a/src/redis_protocol/proxy/CMakeLists.txt b/src/redis_protocol/proxy/CMakeLists.txt index b741360568d..31c80847cd1 100644 --- a/src/redis_protocol/proxy/CMakeLists.txt +++ b/src/redis_protocol/proxy/CMakeLists.txt @@ -26,14 +26,21 @@ set(MY_PROJ_SRC "") # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS pegasus.rproxylib - absl::flat_hash_set - absl::strings - pegasus_geo_lib - event - s2 - pegasus_client_static - ) +set(MY_PROJ_LIBS + pegasus.rproxylib + dsn_utils + absl::flat_hash_set + absl::strings + pegasus_geo_lib + event + s2 + pegasus_client_static + dsn_client + test_utils + rocksdb + lz4 + zstd + snappy) set(MY_BINPLACES "config.ini") diff --git a/src/redis_protocol/proxy_ut/CMakeLists.txt b/src/redis_protocol/proxy_ut/CMakeLists.txt index cf7bb1df373..9dcecd64733 100644 --- a/src/redis_protocol/proxy_ut/CMakeLists.txt +++ b/src/redis_protocol/proxy_ut/CMakeLists.txt @@ -29,15 +29,26 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_BOOST_LIBS Boost::system Boost::filesystem) -set(MY_PROJ_LIBS pegasus.rproxylib - pegasus_base - absl::flat_hash_set - absl::strings - pegasus_geo_lib - s2 - pegasus_client_static - gtest - ) +set(MY_PROJ_LIBS + pegasus.rproxylib + absl::flat_hash_set + absl::strings + pegasus_geo_lib + event + s2 + pegasus_client_static + dsn_client + dsn_runtime + dsn_aio + dsn_utils + sasl2 + gssapi_krb5 + krb5 + gtest + rocksdb + lz4 + zstd + snappy) set(MY_BINPLACES "config.ini" "run.sh") diff --git a/src/replica/CMakeLists.txt b/src/replica/CMakeLists.txt index 5bcd3f57bc8..e0a263f67f3 100644 --- a/src/replica/CMakeLists.txt +++ b/src/replica/CMakeLists.txt @@ -67,19 +67,23 @@ set(MY_PROJ_LIBS dsn_dist_cmd dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_aio dsn_meta_server rocksdb lz4 zstd - snappy) + snappy + zookeeper) set(MY_BOOST_LIBS Boost::filesystem) # Extra files that will be installed set(MY_BINPLACES "") -dsn_add_shared_library() +dsn_add_static_library() add_subdirectory(duplication/test) add_subdirectory(backup/test) diff --git a/src/replica/backup/cold_backup_context.h b/src/replica/backup/cold_backup_context.h index 0d2f07ffc70..acc69be0688 100644 --- a/src/replica/backup/cold_backup_context.h +++ b/src/replica/backup/cold_backup_context.h @@ -30,7 +30,7 @@ #include "backup_types.h" #include "block_service/block_service.h" #include "common/backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication_other_types.h" #include "metadata_types.h" diff --git a/src/replica/backup/replica_backup_manager.cpp b/src/replica/backup/replica_backup_manager.cpp index 390860883a4..5e1d7bf917e 100644 --- a/src/replica/backup/replica_backup_manager.cpp +++ b/src/replica/backup/replica_backup_manager.cpp @@ -28,7 +28,7 @@ #include "backup_types.h" #include "cold_backup_context.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" #include "metadata_types.h" diff --git a/src/replica/backup/replica_backup_server.cpp b/src/replica/backup/replica_backup_server.cpp index 23de8972b38..564241b9d24 100644 --- a/src/replica/backup/replica_backup_server.cpp +++ b/src/replica/backup/replica_backup_server.cpp @@ -20,7 +20,7 @@ #include #include "backup_types.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "replica/replica.h" #include "replica/replica_stub.h" diff --git a/src/replica/backup/test/CMakeLists.txt b/src/replica/backup/test/CMakeLists.txt index fed60e3120f..575dd18bd4f 100644 --- a/src/replica/backup/test/CMakeLists.txt +++ b/src/replica/backup/test/CMakeLists.txt @@ -23,11 +23,23 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_meta_server dsn_replica_server + dsn_nfs + dsn_dist_cmd + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_meta_server dsn_replication_common + dsn.replication.zookeeper_provider + zookeeper + hashtable dsn.block_service + dsn.block_service.hdfs dsn.block_service.local + dsn.failure_detector + dsn_aio dsn_utils - hashtable gtest rocksdb lz4 diff --git a/src/replica/bulk_load/replica_bulk_loader.cpp b/src/replica/bulk_load/replica_bulk_loader.cpp index 6672fdceb3d..835bb9340fb 100644 --- a/src/replica/bulk_load/replica_bulk_loader.cpp +++ b/src/replica/bulk_load/replica_bulk_loader.cpp @@ -26,7 +26,7 @@ #include "block_service/block_service_manager.h" #include "common/bulk_load_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication.codes.h" #include "common/replication_common.h" diff --git a/src/replica/bulk_load/test/CMakeLists.txt b/src/replica/bulk_load/test/CMakeLists.txt index bda1a898198..6e57bee7c75 100644 --- a/src/replica/bulk_load/test/CMakeLists.txt +++ b/src/replica/bulk_load/test/CMakeLists.txt @@ -21,11 +21,26 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS dsn_meta_server +set(MY_PROJ_LIBS + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_meta_server dsn_replica_server + dsn.security + dsn_nfs + dsn_aio + dsn_dist_cmd dsn_replication_common - dsn_runtime + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + dsn.failure_detector + dsn.replication.zookeeper_provider + zookeeper hashtable + dsn_utils gtest test_utils rocksdb diff --git a/src/replica/bulk_load/test/replica_bulk_loader_test.cpp b/src/replica/bulk_load/test/replica_bulk_loader_test.cpp index 59a00cd28bc..b3250459e2e 100644 --- a/src/replica/bulk_load/test/replica_bulk_loader_test.cpp +++ b/src/replica/bulk_load/test/replica_bulk_loader_test.cpp @@ -26,7 +26,7 @@ #include #include "common/bulk_load_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" diff --git a/src/replica/duplication/duplication_pipeline.cpp b/src/replica/duplication/duplication_pipeline.cpp index 8ce736f517f..c32e731408b 100644 --- a/src/replica/duplication/duplication_pipeline.cpp +++ b/src/replica/duplication/duplication_pipeline.cpp @@ -42,14 +42,6 @@ namespace dsn { namespace replication { -// // -// mutation_duplicator // -// // - -/*static*/ std::function( - replica_base *, absl::string_view /*remote cluster*/, absl::string_view /*app*/)> - mutation_duplicator::creator; - // // // load_mutation // // // @@ -121,8 +113,8 @@ ship_mutation::ship_mutation(replica_duplicator *duplicator) _stub(duplicator->_replica->get_replica_stub()), METRIC_VAR_INIT_replica(dup_shipped_bytes) { - _mutation_duplicator = new_mutation_duplicator( - duplicator, _duplicator->remote_cluster_name(), _replica->get_app_info()->app_name); + // _mutation_duplicator = new_mutation_duplicator( + // duplicator, _duplicator->remote_cluster_name(), _replica->get_app_info()->app_name); _mutation_duplicator->set_task_environment(duplicator); } diff --git a/src/replica/duplication/duplication_sync_timer.h b/src/replica/duplication/duplication_sync_timer.h index ff1b6c06609..279e3fc6082 100644 --- a/src/replica/duplication/duplication_sync_timer.h +++ b/src/replica/duplication/duplication_sync_timer.h @@ -21,7 +21,7 @@ #include #include "common//duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "duplication_types.h" #include "replica/replica.h" diff --git a/src/replica/duplication/mutation_duplicator.h b/src/replica/duplication/mutation_duplicator.h index b1c29e00faf..e9c0fd61806 100644 --- a/src/replica/duplication/mutation_duplicator.h +++ b/src/replica/duplication/mutation_duplicator.h @@ -66,11 +66,6 @@ class mutation_duplicator : public replica_base /// \param cb: Call it when all the given mutations were sent successfully virtual void duplicate(mutation_tuple_set mutations, callback cb) = 0; - // Singleton creator of mutation_duplicator. - static std::function( - replica_base *, absl::string_view /*remote cluster*/, absl::string_view /*app name*/)> - creator; - explicit mutation_duplicator(replica_base *r) : replica_base(r) {} virtual ~mutation_duplicator() = default; @@ -83,11 +78,11 @@ class mutation_duplicator : public replica_base pipeline::environment _env; }; -inline std::unique_ptr new_mutation_duplicator( - replica_base *r, absl::string_view remote_cluster_address, absl::string_view app) -{ - return mutation_duplicator::creator(r, remote_cluster_address, app); -} +// inline std::unique_ptr new_mutation_duplicator( +// replica_base *r, absl::string_view remote_cluster_address, absl::string_view app) +//{ +// return mutation_duplicator::create(r, remote_cluster_address, app); +//} } // namespace replication } // namespace dsn diff --git a/src/replica/duplication/replica_duplicator.cpp b/src/replica/duplication/replica_duplicator.cpp index 01c01b40598..f7b1f92c129 100644 --- a/src/replica/duplication/replica_duplicator.cpp +++ b/src/replica/duplication/replica_duplicator.cpp @@ -28,7 +28,7 @@ #include #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" #include "duplication_pipeline.h" diff --git a/src/replica/duplication/replica_duplicator_manager.cpp b/src/replica/duplication/replica_duplicator_manager.cpp index 03ca071121c..25c083568e1 100644 --- a/src/replica/duplication/replica_duplicator_manager.cpp +++ b/src/replica/duplication/replica_duplicator_manager.cpp @@ -21,7 +21,7 @@ #include #include "common//duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "replica/duplication/replica_duplicator.h" #include "replica_duplicator_manager.h" #include "utils/autoref_ptr.h" diff --git a/src/replica/duplication/replica_follower.h b/src/replica/duplication/replica_follower.h index 8a8842fccff..03bd568ffd3 100644 --- a/src/replica/duplication/replica_follower.h +++ b/src/replica/duplication/replica_follower.h @@ -23,7 +23,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "replica/replica_base.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/replica/duplication/test/CMakeLists.txt b/src/replica/duplication/test/CMakeLists.txt index 26e461bd759..31b77703870 100644 --- a/src/replica/duplication/test/CMakeLists.txt +++ b/src/replica/duplication/test/CMakeLists.txt @@ -21,16 +21,30 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS dsn_meta_server +set(MY_PROJ_LIBS dsn_replica_server + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + dsn_nfs + dsn_dist_cmd + dsn_aio + dsn_http + dsn_ranger + dsn_runtime + dsn_meta_server + sasl2 + gssapi_krb5 + krb5 dsn.replication.zookeeper_provider + zookeeper + hashtable dsn_replication_common + dsn.rpc dsn.failure_detector dsn_utils - zookeeper - hashtable - gtest test_utils + gtest rocksdb lz4 zstd diff --git a/src/replica/duplication/test/dup_replica_http_service_test.cpp b/src/replica/duplication/test/dup_replica_http_service_test.cpp index 70b123e3287..da895d080ac 100644 --- a/src/replica/duplication/test/dup_replica_http_service_test.cpp +++ b/src/replica/duplication/test/dup_replica_http_service_test.cpp @@ -21,7 +21,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "duplication_test_base.h" #include "duplication_types.h" #include "gtest/gtest.h" diff --git a/src/replica/duplication/test/duplication_test_base.h b/src/replica/duplication/test/duplication_test_base.h index eb914f38e02..a0adfbadb3a 100644 --- a/src/replica/duplication/test/duplication_test_base.h +++ b/src/replica/duplication/test/duplication_test_base.h @@ -34,9 +34,10 @@ class duplication_test_base : public replica_test_base public: duplication_test_base() { - mutation_duplicator::creator = [](replica_base *r, absl::string_view, absl::string_view) { - return std::make_unique(r); - }; + // mutation_duplicator::creator = [](replica_base *r, absl::string_view, + // absl::string_view) { + // return std::make_unique(r); + // }; stub->_duplication_sync_timer = std::make_unique(stub.get()); } diff --git a/src/replica/duplication/test/load_from_private_log_test.cpp b/src/replica/duplication/test/load_from_private_log_test.cpp index 86237cc0fb9..eb6a6d75e9c 100644 --- a/src/replica/duplication/test/load_from_private_log_test.cpp +++ b/src/replica/duplication/test/load_from_private_log_test.cpp @@ -23,7 +23,7 @@ #include "aio/aio_task.h" #include "aio/file_io.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "consensus_types.h" diff --git a/src/replica/duplication/test/replica_duplicator_manager_test.cpp b/src/replica/duplication/test/replica_duplicator_manager_test.cpp index 31dbacc67cd..861c3bf5688 100644 --- a/src/replica/duplication/test/replica_duplicator_manager_test.cpp +++ b/src/replica/duplication/test/replica_duplicator_manager_test.cpp @@ -23,7 +23,7 @@ #include #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "duplication_test_base.h" #include "duplication_types.h" diff --git a/src/replica/duplication/test/replica_duplicator_test.cpp b/src/replica/duplication/test/replica_duplicator_test.cpp index 3c3847a62da..98d5323b33b 100644 --- a/src/replica/duplication/test/replica_duplicator_test.cpp +++ b/src/replica/duplication/test/replica_duplicator_test.cpp @@ -21,7 +21,7 @@ #include #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "duplication_test_base.h" #include "duplication_types.h" diff --git a/src/replica/duplication/test/replica_follower_test.cpp b/src/replica/duplication/test/replica_follower_test.cpp index eb4b1e4aa40..516effe529f 100644 --- a/src/replica/duplication/test/replica_follower_test.cpp +++ b/src/replica/duplication/test/replica_follower_test.cpp @@ -22,7 +22,7 @@ #include #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "consensus_types.h" #include "dsn.layer2_types.h" #include "duplication_test_base.h" diff --git a/src/replica/log_file.h b/src/replica/log_file.h index fcaff2187a7..14402dae565 100644 --- a/src/replica/log_file.h +++ b/src/replica/log_file.h @@ -34,7 +34,7 @@ #include #include "aio/aio_task.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "runtime/api_task.h" #include "runtime/task/task_code.h" diff --git a/src/replica/mutation.cpp b/src/replica/mutation.cpp index 7814bf299a6..5d13e4d4b36 100644 --- a/src/replica/mutation.cpp +++ b/src/replica/mutation.cpp @@ -32,7 +32,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "replica.h" #include "runtime/api_task.h" diff --git a/src/replica/mutation_log.h b/src/replica/mutation_log.h index c4ce671ecb8..6a172fd09a4 100644 --- a/src/replica/mutation_log.h +++ b/src/replica/mutation_log.h @@ -37,7 +37,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "log_file.h" #include "mutation.h" diff --git a/src/replica/replica.cpp b/src/replica/replica.cpp index 62cd71ae94b..499e8803c15 100644 --- a/src/replica/replica.cpp +++ b/src/replica/replica.cpp @@ -36,7 +36,7 @@ #include "bulk_load/replica_bulk_loader.h" #include "common/backup_common.h" #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replica_envs.h" #include "common/replication_enums.h" #include "consensus_types.h" diff --git a/src/replica/replica_2pc.cpp b/src/replica/replica_2pc.cpp index 3acb42a19a1..a6a851aa4a9 100644 --- a/src/replica/replica_2pc.cpp +++ b/src/replica/replica_2pc.cpp @@ -39,7 +39,7 @@ #include "bulk_load/replica_bulk_loader.h" #include "bulk_load_types.h" #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_common.h" #include "common/replication_enums.h" diff --git a/src/replica/replica_backup.cpp b/src/replica/replica_backup.cpp index f51c20ade3d..d65b76850a9 100644 --- a/src/replica/replica_backup.cpp +++ b/src/replica/replica_backup.cpp @@ -36,7 +36,7 @@ #include "backup/replica_backup_manager.h" #include "backup_types.h" #include "block_service/block_service_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_enums.h" #include "common/replication_other_types.h" diff --git a/src/replica/replica_base.h b/src/replica/replica_base.h index 8909197a642..0f8c57bdecf 100644 --- a/src/replica/replica_base.h +++ b/src/replica/replica_base.h @@ -28,7 +28,7 @@ #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "absl/strings/string_view.h" #include "utils/fmt_logging.h" #include "utils/metrics.h" diff --git a/src/replica/replica_check.cpp b/src/replica/replica_check.cpp index f5a4f5f58d8..5d78ad9d9ad 100644 --- a/src/replica/replica_check.cpp +++ b/src/replica/replica_check.cpp @@ -31,7 +31,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_common.h" #include "common/replication_enums.h" diff --git a/src/replica/replica_chkpt.cpp b/src/replica/replica_chkpt.cpp index d255573dd9a..a9ad6881ac5 100644 --- a/src/replica/replica_chkpt.cpp +++ b/src/replica/replica_chkpt.cpp @@ -33,7 +33,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_enums.h" #include "common/replication_other_types.h" diff --git a/src/replica/replica_config.cpp b/src/replica/replica_config.cpp index de14a2d1234..8fa4b4c04e2 100644 --- a/src/replica/replica_config.cpp +++ b/src/replica/replica_config.cpp @@ -40,7 +40,7 @@ #include #include "bulk_load/replica_bulk_loader.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replica_envs.h" #include "common/replication.codes.h" #include "common/replication_common.h" diff --git a/src/replica/replica_context.h b/src/replica/replica_context.h index 32da41d38ba..5e570d4f62d 100644 --- a/src/replica/replica_context.h +++ b/src/replica/replica_context.h @@ -33,7 +33,7 @@ #include #include "bulk_load_types.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_common.h" #include "common/replication_other_types.h" #include "consensus_types.h" diff --git a/src/replica/replica_disk_migrator.cpp b/src/replica/replica_disk_migrator.cpp index 355421503ad..13caddeefa0 100644 --- a/src/replica/replica_disk_migrator.cpp +++ b/src/replica/replica_disk_migrator.cpp @@ -22,7 +22,7 @@ #include "absl/strings/string_view.h" #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_enums.h" #include "metadata_types.h" diff --git a/src/replica/replica_http_service.cpp b/src/replica/replica_http_service.cpp index 79bf9c6d67d..c14a63cfa97 100644 --- a/src/replica/replica_http_service.cpp +++ b/src/replica/replica_http_service.cpp @@ -27,7 +27,7 @@ #include #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "duplication/duplication_sync_timer.h" #include "http/http_server.h" #include "replica/replica_stub.h" diff --git a/src/replica/replica_init.cpp b/src/replica/replica_init.cpp index 0948a3685ca..45a798220df 100644 --- a/src/replica/replica_init.cpp +++ b/src/replica/replica_init.cpp @@ -31,7 +31,7 @@ #include #include "backup/replica_backup_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "consensus_types.h" diff --git a/src/replica/replica_learn.cpp b/src/replica/replica_learn.cpp index c69076ac99e..2722b79875f 100644 --- a/src/replica/replica_learn.cpp +++ b/src/replica/replica_learn.cpp @@ -40,7 +40,7 @@ #include // IWYU pragma: keep #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_enums.h" #include "common/replication_other_types.h" diff --git a/src/replica/replica_restore.cpp b/src/replica/replica_restore.cpp index 9c255df0b47..dda0b2588ef 100644 --- a/src/replica/replica_restore.cpp +++ b/src/replica/replica_restore.cpp @@ -33,7 +33,7 @@ #include "block_service/block_service.h" #include "block_service/block_service_manager.h" #include "common/backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" diff --git a/src/replica/replica_stub.h b/src/replica/replica_stub.h index e702f70485a..2319e61fb3f 100644 --- a/src/replica/replica_stub.h +++ b/src/replica/replica_stub.h @@ -42,7 +42,7 @@ #include "bulk_load_types.h" #include "common/bulk_load_common.h" #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_common.h" #include "common/replication_other_types.h" #include "consensus_types.h" diff --git a/src/replica/replica_throttle.cpp b/src/replica/replica_throttle.cpp index ed6bd1cceef..26ebf567efd 100644 --- a/src/replica/replica_throttle.cpp +++ b/src/replica/replica_throttle.cpp @@ -21,7 +21,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replica_envs.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" diff --git a/src/replica/replication_service_app.cpp b/src/replica/replication_service_app.cpp index 7200a6404c6..8ca967f5918 100644 --- a/src/replica/replication_service_app.cpp +++ b/src/replica/replication_service_app.cpp @@ -26,7 +26,7 @@ #include "replica/replication_service_app.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_common.h" #include "http/http_server.h" #include "http/service_version.h" diff --git a/src/replica/split/replica_split_manager.h b/src/replica/split/replica_split_manager.h index 7435e1705d1..a4db4df24a3 100644 --- a/src/replica/split/replica_split_manager.h +++ b/src/replica/split/replica_split_manager.h @@ -24,7 +24,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "metadata_types.h" #include "replica/mutation.h" diff --git a/src/replica/split/test/CMakeLists.txt b/src/replica/split/test/CMakeLists.txt index 7e77ba7302f..b21c989311d 100644 --- a/src/replica/split/test/CMakeLists.txt +++ b/src/replica/split/test/CMakeLists.txt @@ -21,13 +21,32 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS dsn_meta_server +set(MY_PROJ_LIBS + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_meta_server dsn_replica_server + dsn.security + dsn_nfs + dsn_aio + dsn_dist_cmd dsn_replication_common - dsn_runtime + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + dsn.failure_detector + dsn.replication.zookeeper_provider + zookeeper hashtable + dsn_utils gtest -) + test_utils + rocksdb + lz4 + zstd + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/replica/split/test/replica_split_test.cpp b/src/replica/split/test/replica_split_test.cpp index 53315405b3a..a9eb1234524 100644 --- a/src/replica/split/test/replica_split_test.cpp +++ b/src/replica/split/test/replica_split_test.cpp @@ -23,7 +23,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_common.h" #include "common/replication_other_types.h" diff --git a/src/replica/storage/simple_kv/CMakeLists.txt b/src/replica/storage/simple_kv/CMakeLists.txt index a2f8506770c..f4b232d51a4 100644 --- a/src/replica/storage/simple_kv/CMakeLists.txt +++ b/src/replica/storage/simple_kv/CMakeLists.txt @@ -39,10 +39,29 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_replica_server + dsn_nfs + dsn_dist_cmd + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local dsn_meta_server + dsn_replication_common dsn_client - dsn_runtime + dsn.failure_detector + dsn.replication.zookeeper_provider + zookeeper hashtable + dsn_http + dsn_runtime + dsn_aio + dsn_utils + sasl2 + gssapi_krb5 + krb5 rocksdb lz4 zstd diff --git a/src/replica/storage/simple_kv/test/CMakeLists.txt b/src/replica/storage/simple_kv/test/CMakeLists.txt index 0bce41b7124..6b7ba271a63 100644 --- a/src/replica/storage/simple_kv/test/CMakeLists.txt +++ b/src/replica/storage/simple_kv/test/CMakeLists.txt @@ -31,16 +31,30 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_replica_server + dsn_nfs + dsn_dist_cmd + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local dsn_meta_server dsn_replication_common dsn_client dsn.failure_detector dsn.replication.zookeeper_provider - dsn_runtime zookeeper hashtable - gtest + dsn_http + dsn_runtime + dsn_aio dsn_utils + sasl2 + gssapi_krb5 + krb5 + gtest rocksdb lz4 zstd diff --git a/src/replica/storage/simple_kv/test/client.cpp b/src/replica/storage/simple_kv/test/client.cpp index f93dffe1b0f..88667f6afd8 100644 --- a/src/replica/storage/simple_kv/test/client.cpp +++ b/src/replica/storage/simple_kv/test/client.cpp @@ -32,7 +32,7 @@ #include #include "case.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "replica/storage/simple_kv/simple_kv.client.h" diff --git a/src/replica/storage/simple_kv/test/common.h b/src/replica/storage/simple_kv/test/common.h index f042d2b2138..b7afa2acff5 100644 --- a/src/replica/storage/simple_kv/test/common.h +++ b/src/replica/storage/simple_kv/test/common.h @@ -34,7 +34,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "metadata_types.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/replica/test/CMakeLists.txt b/src/replica/test/CMakeLists.txt index 94b5c89348a..c61abdcabf9 100644 --- a/src/replica/test/CMakeLists.txt +++ b/src/replica/test/CMakeLists.txt @@ -34,18 +34,26 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS + dsn_http + dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_meta_server dsn_replica_server - dsn.replication.zookeeper_provider + dsn.security + dsn_nfs + dsn_aio + dsn_dist_cmd dsn_replication_common dsn.block_service - dsn.block_service.local dsn.block_service.hdfs + dsn.block_service.local dsn.failure_detector - dsn_http - dsn_runtime + dsn.replication.zookeeper_provider zookeeper hashtable + dsn_utils gtest test_utils rocksdb diff --git a/src/replica/test/backup_block_service_mock.h b/src/replica/test/backup_block_service_mock.h index 4ac8bc95fe4..632301ab8f3 100644 --- a/src/replica/test/backup_block_service_mock.h +++ b/src/replica/test/backup_block_service_mock.h @@ -22,7 +22,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/task/task_tracker.h" #include "block_service/block_service.h" #include "replica/replica_context.h" diff --git a/src/replica/test/cold_backup_context_test.cpp b/src/replica/test/cold_backup_context_test.cpp index 529ac0a09c0..91da0b10d41 100644 --- a/src/replica/test/cold_backup_context_test.cpp +++ b/src/replica/test/cold_backup_context_test.cpp @@ -30,7 +30,7 @@ #include "block_service/block_service.h" #include "block_service/test/block_service_mock.h" #include "common/backup_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "gtest/gtest.h" #include "metadata_types.h" diff --git a/src/replica/test/mock_utils.h b/src/replica/test/mock_utils.h index bf2e8940022..00a48a0be08 100644 --- a/src/replica/test/mock_utils.h +++ b/src/replica/test/mock_utils.h @@ -433,8 +433,9 @@ class mock_mutation_log_private : public mutation_log_private }; typedef dsn::ref_ptr mock_mutation_log_private_ptr; -struct mock_mutation_duplicator : public mutation_duplicator +class mock_mutation_duplicator : public mutation_duplicator { +public: explicit mock_mutation_duplicator(replica_base *r) : mutation_duplicator(r) {} void duplicate(mutation_tuple_set mut, callback cb) override { _func(mut, cb); } diff --git a/src/replica/test/mutation_log_learn_test.cpp b/src/replica/test/mutation_log_learn_test.cpp index f5946b53e92..11950b9b4d4 100644 --- a/src/replica/test/mutation_log_learn_test.cpp +++ b/src/replica/test/mutation_log_learn_test.cpp @@ -32,7 +32,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "consensus_types.h" diff --git a/src/replica/test/open_replica_test.cpp b/src/replica/test/open_replica_test.cpp index 790e4e1dfaf..8dd48164c62 100644 --- a/src/replica/test/open_replica_test.cpp +++ b/src/replica/test/open_replica_test.cpp @@ -20,7 +20,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" diff --git a/src/replica/test/replica_disk_migrate_test.cpp b/src/replica/test/replica_disk_migrate_test.cpp index f730b2fd1e2..5043f527f18 100644 --- a/src/replica/test/replica_disk_migrate_test.cpp +++ b/src/replica/test/replica_disk_migrate_test.cpp @@ -26,7 +26,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "common/replication_other_types.h" #include "dsn.layer2_types.h" diff --git a/src/replica/test/replica_disk_test.cpp b/src/replica/test/replica_disk_test.cpp index 5866da6ab79..09715be52af 100644 --- a/src/replica/test/replica_disk_test.cpp +++ b/src/replica/test/replica_disk_test.cpp @@ -29,7 +29,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" diff --git a/src/replica/test/replica_learn_test.cpp b/src/replica/test/replica_learn_test.cpp index b926fa4a82a..a699402cc8c 100644 --- a/src/replica/test/replica_learn_test.cpp +++ b/src/replica/test/replica_learn_test.cpp @@ -20,7 +20,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "consensus_types.h" #include "dsn.layer2_types.h" diff --git a/src/replica/test/replica_test.cpp b/src/replica/test/replica_test.cpp index 46747a32063..9480e429a7e 100644 --- a/src/replica/test/replica_test.cpp +++ b/src/replica/test/replica_test.cpp @@ -30,7 +30,7 @@ #include "backup_types.h" #include "common/backup_common.h" #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replica_envs.h" #include "common/replication.codes.h" #include "common/replication_enums.h" diff --git a/src/runtime/CMakeLists.txt b/src/runtime/CMakeLists.txt index d5757717acd..cc43f38fe18 100644 --- a/src/runtime/CMakeLists.txt +++ b/src/runtime/CMakeLists.txt @@ -22,14 +22,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -add_subdirectory(test) -add_subdirectory(rpc) -add_subdirectory(task) -add_subdirectory(security) -add_subdirectory(ranger) +set(MY_PROJ_NAME dsn_runtime) # TODO(zlw) remove perf_counter from dsn_runtime after the refactor by WuTao -add_library(dsn_runtime STATIC +set(MY_PROJ_SRC $ $ $ @@ -51,8 +47,19 @@ add_library(dsn_runtime STATIC threadpool_code.cpp tool_api.cpp tracer.cpp - zlocks.cpp - ) -target_link_libraries(dsn_runtime PRIVATE dsn_utils sasl2 gssapi_krb5 krb5) -define_file_basename_for_sources(dsn_runtime) -install(TARGETS dsn_runtime DESTINATION "lib") + zlocks.cpp) + +set(MY_PROJ_LIBS + dsn_meta_server + dsn_utils + sasl2 + gssapi_krb5 + krb5) + +dsn_add_static_library() + +add_subdirectory(rpc) +add_subdirectory(task) +add_subdirectory(security) +add_subdirectory(ranger) +add_subdirectory(test) \ No newline at end of file diff --git a/src/runtime/api_layer1.h b/src/runtime/api_layer1.h index dc5e3170324..64a281ce233 100644 --- a/src/runtime/api_layer1.h +++ b/src/runtime/api_layer1.h @@ -31,7 +31,7 @@ #pragma once #include "runtime/api_task.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/rpc_address.h" #include "runtime/task/task_tracker.h" diff --git a/src/runtime/ranger/ranger_resource_policy_manager.cpp b/src/runtime/ranger/ranger_resource_policy_manager.cpp index 4bc5ee54ff8..e56e24ff3c8 100644 --- a/src/runtime/ranger/ranger_resource_policy_manager.cpp +++ b/src/runtime/ranger/ranger_resource_policy_manager.cpp @@ -51,6 +51,7 @@ #include "runtime/task/task.h" #include "runtime/task/task_code.h" #include "utils/blob.h" +#include "utils/filesystem.h" #include "utils/flags.h" #include "utils/fmt_logging.h" #include "utils/process_utils.h" @@ -205,7 +206,7 @@ ranger_resource_policy_manager::ranger_resource_policy_manager( void ranger_resource_policy_manager::start() { CHECK_NOTNULL(_meta_svc, ""); - _ranger_policy_meta_root = dsn::replication::meta_options::concat_path_unix_style( + _ranger_policy_meta_root = dsn::utils::filesystem::concat_path_unix_style( _meta_svc->cluster_root(), "ranger_policy_meta_root"); tasking::enqueue_timer(LPC_USE_RANGER_ACCESS_CONTROL, &_tracker, diff --git a/src/runtime/rpc/CMakeLists.txt b/src/runtime/rpc/CMakeLists.txt index 08de0852f6e..a740e995d72 100644 --- a/src/runtime/rpc/CMakeLists.txt +++ b/src/runtime/rpc/CMakeLists.txt @@ -24,6 +24,7 @@ set(MY_PROJ_NAME dsn.rpc) +set(MY_PROJ_SRC "") # Search mode for source files under CURRENT project directory? # "GLOB_RECURSE" for recursive search # "GLOB" for non-recursive search diff --git a/src/runtime/rpc/raw_message_parser.cpp b/src/runtime/rpc/raw_message_parser.cpp index 53cde8de6ce..1ed6885393b 100644 --- a/src/runtime/rpc/raw_message_parser.cpp +++ b/src/runtime/rpc/raw_message_parser.cpp @@ -30,7 +30,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "network.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" diff --git a/src/runtime/rpc/rpc_engine.cpp b/src/runtime/rpc/rpc_engine.cpp index 97394d7f321..13fd20a42a2 100644 --- a/src/runtime/rpc/rpc_engine.cpp +++ b/src/runtime/rpc/rpc_engine.cpp @@ -32,7 +32,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/api_layer1.h" #include "runtime/global_config.h" #include "runtime/rpc/group_address.h" diff --git a/src/runtime/rpc/rpc_message.h b/src/runtime/rpc/rpc_message.h index d07cb0c5b6e..809f419633f 100644 --- a/src/runtime/rpc/rpc_message.h +++ b/src/runtime/rpc/rpc_message.h @@ -31,7 +31,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "rpc_address.h" #include "runtime/task/task_code.h" #include "runtime/task/task_spec.h" diff --git a/src/runtime/rpc/rpc_stream.h b/src/runtime/rpc/rpc_stream.h index 62dfc822841..cc108b258a0 100644 --- a/src/runtime/rpc/rpc_stream.h +++ b/src/runtime/rpc/rpc_stream.h @@ -26,7 +26,7 @@ #pragma once -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/api_layer1.h" #include "runtime/api_task.h" #include "runtime/app_model.h" diff --git a/src/runtime/rpc/thrift_message_parser.cpp b/src/runtime/rpc/thrift_message_parser.cpp index 08bbfcb872b..5f73786c243 100644 --- a/src/runtime/rpc/thrift_message_parser.cpp +++ b/src/runtime/rpc/thrift_message_parser.cpp @@ -32,7 +32,7 @@ #include #include "boost/smart_ptr/shared_ptr.hpp" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/serialization_helper/thrift_helper.h" #include "runtime/rpc/rpc_message.h" #include "runtime/rpc/rpc_stream.h" diff --git a/src/runtime/service_app.h b/src/runtime/service_app.h index 0e6e2cfc86e..dadbed4c87b 100644 --- a/src/runtime/service_app.h +++ b/src/runtime/service_app.h @@ -26,19 +26,19 @@ #pragma once -#include "runtime/api_task.h" +#include +#include + #include "runtime/api_layer1.h" +#include "runtime/api_task.h" #include "runtime/app_model.h" +#include "runtime/rpc/rpc_address.h" +#include "runtime/task/task_code.h" #include "utils/api_utilities.h" #include "utils/error_code.h" -#include "utils/threadpool_code.h" -#include "runtime/task/task_code.h" -#include "common/gpid.h" -#include "runtime/rpc/rpc_address.h" -#include "common/gpid.h" #include "utils/factory_store.h" -#include -#include +#include "utils/gpid.h" +#include "utils/threadpool_code.h" namespace dsn { /*! diff --git a/src/runtime/service_engine.cpp b/src/runtime/service_engine.cpp index ee0c742d812..94cc1fed2e9 100644 --- a/src/runtime/service_engine.cpp +++ b/src/runtime/service_engine.cpp @@ -32,7 +32,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/node_scoper.h" #include "runtime/rpc/rpc_engine.h" #include "runtime/rpc/rpc_message.h" diff --git a/src/runtime/task/CMakeLists.txt b/src/runtime/task/CMakeLists.txt index ad09763cf6d..edc6ad04150 100644 --- a/src/runtime/task/CMakeLists.txt +++ b/src/runtime/task/CMakeLists.txt @@ -24,6 +24,7 @@ set(MY_PROJ_NAME dsn.task) +set(MY_PROJ_SRC "") # Search mode for source files under CURRENT project directory? # "GLOB_RECURSE" for recursive search # "GLOB" for non-recursive search diff --git a/src/runtime/test/CMakeLists.txt b/src/runtime/test/CMakeLists.txt index 38e52a4f5be..8dbf69806c6 100644 --- a/src/runtime/test/CMakeLists.txt +++ b/src/runtime/test/CMakeLists.txt @@ -24,16 +24,30 @@ set(MY_PROJ_NAME dsn_runtime_tests) +set(MY_PROJ_SRC "") # Search mode for source files under CURRENT project directory? # "GLOB_RECURSE" for recursive search # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - gtest dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_aio dsn_meta_server + dsn_dist_cmd + dsn_replication_common + dsn.replication.zookeeper_provider + zookeeper + hashtable + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + dsn.failure_detector + dsn_utils + gtest rocksdb lz4 zstd diff --git a/src/runtime/test/rpc_holder_test.cpp b/src/runtime/test/rpc_holder_test.cpp index 8d1b838d856..9efe392ddeb 100644 --- a/src/runtime/test/rpc_holder_test.cpp +++ b/src/runtime/test/rpc_holder_test.cpp @@ -29,7 +29,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/serialization_helper/dsn.layer2_types.h" #include "gtest/gtest.h" #include "runtime/message_utils.h" diff --git a/src/runtime/test/rpc_message.cpp b/src/runtime/test/rpc_message.cpp index a596b2cd297..7a165db17c3 100644 --- a/src/runtime/test/rpc_message.cpp +++ b/src/runtime/test/rpc_message.cpp @@ -30,7 +30,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "gtest/gtest.h" #include "runtime/message_utils.cpp" diff --git a/src/runtime/test/test_utils.h b/src/runtime/test/test_utils.h index 29520eee975..be3be1a0f2c 100644 --- a/src/runtime/test/test_utils.h +++ b/src/runtime/test/test_utils.h @@ -26,24 +26,25 @@ #pragma once -#include "runtime/api_task.h" +#include +#include + #include "runtime/api_layer1.h" +#include "runtime/api_task.h" #include "runtime/app_model.h" -#include "utils/api_utilities.h" -#include "utils/error_code.h" -#include "utils/threadpool_code.h" -#include "runtime/task/task_code.h" -#include "common/gpid.h" -#include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" +#include "runtime/rpc/serialization.h" #include "runtime/serverlet.h" #include "runtime/service_app.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_host_port.h" #include "runtime/task/task.h" +#include "runtime/task/task_code.h" #include "runtime/task/task_worker.h" -#include -#include +#include "utils/api_utilities.h" +#include "utils/error_code.h" +#include "utils/gpid.h" +#include "utils/threadpool_code.h" using namespace ::dsn; diff --git a/src/runtime/test/thrift_message_parser_test.cpp b/src/runtime/test/thrift_message_parser_test.cpp index 722b2860b6b..41ba099c694 100644 --- a/src/runtime/test/thrift_message_parser_test.cpp +++ b/src/runtime/test/thrift_message_parser_test.cpp @@ -24,7 +24,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/serialization_helper/thrift_helper.h" #include "gtest/gtest.h" #include "request_meta_types.h" diff --git a/src/sample/CMakeLists.txt b/src/sample/CMakeLists.txt index b0618dfca86..43e68a1f77a 100644 --- a/src/sample/CMakeLists.txt +++ b/src/sample/CMakeLists.txt @@ -15,13 +15,24 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "sample") +set(MY_PROJ_NAME sample) set(MY_SRC_SEARCH_MODE "GLOB") +# TODO(yingchun): should link pegasus_client shared lib only! set(MY_PROJ_LIBS - pegasus_client_static - ) + pegasus_client_static + dsn_client + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_utils + rocksdb + lz4 + zstd + snappy) set(MY_BOOST_LIBS Boost::filesystem Boost::system) diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 8c8daa4d12d..d5658800cda 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "pegasus_server") +set(MY_PROJ_NAME pegasus_server) # Source files under CURRENT project directory will be automatically included. # You can manually set MY_PROJ_SRC to include source files under other directories. @@ -27,14 +27,22 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS + dsn_runtime dsn_replica_server + dsn_nfs + dsn_aio dsn_meta_server dsn_replication_common dsn_client - dsn.block_service.local + dsn_dist_cmd dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local dsn.failure_detector dsn.replication.zookeeper_provider + zookeeper + hashtable + dsn_http dsn_utils rocksdb lz4 @@ -42,8 +50,7 @@ set(MY_PROJ_LIBS snappy pegasus_base pegasus_client_static - event - hashtable) + event) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/server/hotspot_partition_calculator.cpp b/src/server/hotspot_partition_calculator.cpp index 37925403329..57726d95eeb 100644 --- a/src/server/hotspot_partition_calculator.cpp +++ b/src/server/hotspot_partition_calculator.cpp @@ -23,7 +23,7 @@ #include #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/serialization_helper/dsn.layer2_types.h" #include "perf_counter/perf_counter.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/server/pegasus_mutation_duplicator.cpp b/src/server/pegasus_mutation_duplicator.cpp index 3553bcfc792..6a04326f3f0 100644 --- a/src/server/pegasus_mutation_duplicator.cpp +++ b/src/server/pegasus_mutation_duplicator.cpp @@ -59,21 +59,6 @@ METRIC_DEFINE_counter(replica, dsn::metric_unit::kRequests, "The number of failed DUPLICATE requests sent from client"); -namespace dsn { -namespace replication { -struct replica_base; - -/// static definition of mutation_duplicator::creator. -/*static*/ std::function( - replica_base *, absl::string_view, absl::string_view)> - mutation_duplicator::creator = - [](replica_base *r, absl::string_view remote, absl::string_view app) { - return std::make_unique(r, remote, app); - }; - -} // namespace replication -} // namespace dsn - namespace pegasus { namespace server { @@ -105,6 +90,12 @@ using namespace dsn::literals::chrono_literals; __builtin_unreachable(); } +std::unique_ptr pegasus_mutation_duplicator::create( + replica_base *r, absl::string_view remote, absl::string_view app) +{ + return std::make_unique(r, remote, app); +} + pegasus_mutation_duplicator::pegasus_mutation_duplicator(dsn::replication::replica_base *r, absl::string_view remote_cluster, absl::string_view app) diff --git a/src/server/pegasus_mutation_duplicator.h b/src/server/pegasus_mutation_duplicator.h index 2d81a6a37c2..a2c837464a8 100644 --- a/src/server/pegasus_mutation_duplicator.h +++ b/src/server/pegasus_mutation_duplicator.h @@ -60,6 +60,9 @@ class pegasus_mutation_duplicator : public dsn::replication::mutation_duplicator using duplicate_rpc = dsn::apps::duplicate_rpc; public: + static std::unique_ptr + create(replica_base *, absl::string_view /*remote cluster*/, absl::string_view /*app name*/); + pegasus_mutation_duplicator(dsn::replication::replica_base *r, absl::string_view remote_cluster, absl::string_view app); diff --git a/src/server/pegasus_server_impl.h b/src/server/pegasus_server_impl.h index 4a2b8b522be..145486c7aa0 100644 --- a/src/server/pegasus_server_impl.h +++ b/src/server/pegasus_server_impl.h @@ -37,7 +37,7 @@ #include #include "bulk_load_types.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "metadata_types.h" #include "pegasus_manual_compact_service.h" #include "pegasus_read_service.h" diff --git a/src/server/pegasus_server_impl_init.cpp b/src/server/pegasus_server_impl_init.cpp index 9c6cd2d5b63..9f5f19e4c8c 100644 --- a/src/server/pegasus_server_impl_init.cpp +++ b/src/server/pegasus_server_impl_init.cpp @@ -37,7 +37,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "hashkey_transform.h" #include "hotkey_collector.h" #include "pegasus_event_listener.h" diff --git a/src/server/pegasus_server_write.cpp b/src/server/pegasus_server_write.cpp index 6c98971cb09..004918fe7be 100644 --- a/src/server/pegasus_server_write.cpp +++ b/src/server/pegasus_server_write.cpp @@ -25,7 +25,7 @@ #include #include "base/pegasus_key_schema.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "logging_utils.h" #include "pegasus_rpc_types.h" diff --git a/src/server/test/CMakeLists.txt b/src/server/test/CMakeLists.txt index 2b4c96ac1fe..281171744fd 100644 --- a/src/server/test/CMakeLists.txt +++ b/src/server/test/CMakeLists.txt @@ -36,26 +36,36 @@ set(MY_PROJ_SRC "../pegasus_server_impl.cpp" set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_replica_server + dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_meta_server + dsn_replica_server + dsn.security + dsn_nfs + dsn_aio + dsn_dist_cmd dsn_replication_common dsn_client - dsn.block_service.local dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local dsn.failure_detector dsn.replication.zookeeper_provider + zookeeper + hashtable dsn_utils - rocksdb - lz4 - zstd - snappy pegasus_client_static event pegasus_base gtest gmock - hashtable -) + rocksdb + lz4 + zstd + snappy) + add_definitions(-DPEGASUS_UNIT_TEST) add_definitions(-DENABLE_FAIL) diff --git a/src/server/test/hotkey_collector_test.cpp b/src/server/test/hotkey_collector_test.cpp index a888288352c..cb2637c2805 100644 --- a/src/server/test/hotkey_collector_test.cpp +++ b/src/server/test/hotkey_collector_test.cpp @@ -23,7 +23,7 @@ #include #include "base/pegasus_key_schema.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "gtest/gtest.h" #include "pegasus_server_test_base.h" diff --git a/src/server/test/pegasus_mutation_duplicator_test.cpp b/src/server/test/pegasus_mutation_duplicator_test.cpp index 8ddbd38b4b1..fd91cbc4e32 100644 --- a/src/server/test/pegasus_mutation_duplicator_test.cpp +++ b/src/server/test/pegasus_mutation_duplicator_test.cpp @@ -32,7 +32,7 @@ #include "backup_types.h" #include "base/pegasus_rpc_types.h" #include "common/duplication_common.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "duplication_internal_types.h" #include "gtest/gtest.h" @@ -68,7 +68,7 @@ class pegasus_mutation_duplicator_test : public pegasus_server_test_base void test_duplicate() { replica_base replica(dsn::gpid(1, 1), "fake_replica", "temp"); - auto duplicator = new_mutation_duplicator(&replica, "onebox2", "temp"); + auto duplicator = pegasus_mutation_duplicator::create(&replica, "onebox2", "temp"); duplicator->set_task_environment(&_env); std::string sort_key; @@ -137,7 +137,7 @@ class pegasus_mutation_duplicator_test : public pegasus_server_test_base void test_duplicate_failed() { replica_base replica(dsn::gpid(1, 1), "fake_replica", "temp"); - auto duplicator = new_mutation_duplicator(&replica, "onebox2", "temp"); + auto duplicator = pegasus_mutation_duplicator::create(&replica, "onebox2", "temp"); duplicator->set_task_environment(&_env); std::string sort_key; @@ -213,7 +213,7 @@ class pegasus_mutation_duplicator_test : public pegasus_server_test_base void test_duplicate_isolated_hashkeys() { replica_base replica(dsn::gpid(1, 1), "fake_replica", "temp"); - auto duplicator = new_mutation_duplicator(&replica, "onebox2", "temp"); + auto duplicator = pegasus_mutation_duplicator::create(&replica, "onebox2", "temp"); duplicator->set_task_environment(&_env); size_t total_size = 4000; @@ -272,7 +272,7 @@ class pegasus_mutation_duplicator_test : public pegasus_server_test_base void test_create_duplicator() { replica_base replica(dsn::gpid(1, 1), "fake_replica", "temp"); - auto duplicator = new_mutation_duplicator(&replica, "onebox2", "temp"); + auto duplicator = pegasus_mutation_duplicator::create(&replica, "onebox2", "temp"); duplicator->set_task_environment(&_env); auto duplicator_impl = dynamic_cast(duplicator.get()); ASSERT_EQ(duplicator_impl->_remote_cluster_id, 2); @@ -375,7 +375,7 @@ TEST_P(pegasus_mutation_duplicator_test, create_duplicator) { test_create_duplic TEST_P(pegasus_mutation_duplicator_test, duplicate_duplicate) { replica_base replica(dsn::gpid(1, 1), "fake_replica", "temp"); - auto duplicator = new_mutation_duplicator(&replica, "onebox2", "temp"); + auto duplicator = pegasus_mutation_duplicator::create(&replica, "onebox2", "temp"); duplicator->set_task_environment(&_env); dsn::apps::update_request request; diff --git a/src/server/test/pegasus_server_write_test.cpp b/src/server/test/pegasus_server_write_test.cpp index 482f044a829..055a308a2b8 100644 --- a/src/server/test/pegasus_server_write_test.cpp +++ b/src/server/test/pegasus_server_write_test.cpp @@ -25,7 +25,7 @@ #include #include "base/pegasus_key_schema.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "gtest/gtest.h" #include "message_utils.h" #include "pegasus_rpc_types.h" diff --git a/src/server/test/pegasus_write_service_test.cpp b/src/server/test/pegasus_write_service_test.cpp index 8f861f3403e..12ebe2cd00d 100644 --- a/src/server/test/pegasus_write_service_test.cpp +++ b/src/server/test/pegasus_write_service_test.cpp @@ -27,7 +27,7 @@ #include #include "base/pegasus_key_schema.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "duplication_internal_types.h" #include "gtest/gtest.h" #include "message_utils.h" diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index 81271006e1f..390cd31a025 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "pegasus_shell") +set(MY_PROJ_NAME pegasus_shell) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -28,27 +28,39 @@ set(MY_PROJ_SRC "linenoise/linenoise.c" "sds/sds.c") set(MY_SRC_SEARCH_MODE "GLOB_RECURSE") set(MY_PROJ_LIBS - pegasus_base dsn.replication.tool - dsn_replica_server dsn_meta_server + dsn_runtime + dsn_replica_server + dsn_nfs + dsn_aio dsn_replication_common dsn_client - dsn_utils - dsn.block_service.local - dsn.block_service.hdfs + dsn_dist_cmd dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local dsn.failure_detector - pegasus_client_static - pegasus_geo_lib + dsn.replication.zookeeper_provider + zookeeper + hashtable + dsn_http + dsn_utils rocksdb lz4 zstd snappy + pegasus_base + pegasus_client_static + event + dsn_ranger + pegasus_geo_lib + s2 absl::flat_hash_set absl::strings - s2 - hdfs) + sasl2 + gssapi_krb5 + krb5) set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini") diff --git a/src/shell/commands/debugger.cpp b/src/shell/commands/debugger.cpp index 1080c150600..6c27cdd6edf 100644 --- a/src/shell/commands/debugger.cpp +++ b/src/shell/commands/debugger.cpp @@ -47,7 +47,7 @@ #include #include "base/idl_utils.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "pegasus_key_schema.h" #include "pegasus_utils.h" diff --git a/src/shell/commands/detect_hotkey.cpp b/src/shell/commands/detect_hotkey.cpp index 6d300d31d35..9aa4dbb3ab3 100644 --- a/src/shell/commands/detect_hotkey.cpp +++ b/src/shell/commands/detect_hotkey.cpp @@ -22,7 +22,7 @@ #include #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "replica_admin_types.h" #include "runtime/rpc/rpc_address.h" #include "shell/argh.h" diff --git a/src/shell/commands/rebalance.cpp b/src/shell/commands/rebalance.cpp index 43a591cfc40..39a896ffa62 100644 --- a/src/shell/commands/rebalance.cpp +++ b/src/shell/commands/rebalance.cpp @@ -29,7 +29,7 @@ #include #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "meta_admin_types.h" #include "runtime/rpc/rpc_address.h" #include "shell/command_executor.h" diff --git a/src/shell/commands/recovery.cpp b/src/shell/commands/recovery.cpp index 8df98616c67..c7a9f60023d 100644 --- a/src/shell/commands/recovery.cpp +++ b/src/shell/commands/recovery.cpp @@ -29,7 +29,7 @@ #include #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "meta_admin_types.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/shell/commands/table_management.cpp b/src/shell/commands/table_management.cpp index 806a7a13dcf..59e37860efa 100644 --- a/src/shell/commands/table_management.cpp +++ b/src/shell/commands/table_management.cpp @@ -34,7 +34,7 @@ #include #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/json_helper.h" #include "dsn.layer2_types.h" #include "meta_admin_types.h" diff --git a/src/test/bench_test/CMakeLists.txt b/src/test/bench_test/CMakeLists.txt index 5a52808d8db..32e4d354a10 100644 --- a/src/test/bench_test/CMakeLists.txt +++ b/src/test/bench_test/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "pegasus_bench") +set(MY_PROJ_NAME pegasus_bench) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -29,14 +29,17 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS pegasus_client_static + dsn_client + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils rocksdb lz4 zstd - snappy - sasl2 - gssapi_krb5 - krb5) + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/backup_restore/CMakeLists.txt b/src/test/function_test/backup_restore/CMakeLists.txt index 41a6c6ed2b1..a41b6e79398 100644 --- a/src/test/function_test/backup_restore/CMakeLists.txt +++ b/src/test/function_test/backup_restore/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "backup_restore_test") +set(MY_PROJ_NAME backup_restore_test) project(${MY_PROJ_NAME} C CXX) set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") @@ -23,14 +23,15 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_client dsn_replication_common - dsn_utils - gtest + dsn_runtime sasl2 gssapi_krb5 krb5 function_test_utils pegasus_client_static - test_utils) + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/base_api/CMakeLists.txt b/src/test/function_test/base_api/CMakeLists.txt index 3e688f3a179..ca08fab04bb 100644 --- a/src/test/function_test/base_api/CMakeLists.txt +++ b/src/test/function_test/base_api/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "base_api_test") +set(MY_PROJ_NAME base_api_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -28,17 +28,17 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_client - dsn_replication_common - dsn_utils - pegasus_client_static - gtest - sasl2 - gssapi_krb5 - krb5 - function_test_utils - test_utils - ) + dsn_client + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + function_test_utils + pegasus_client_static + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/bulk_load/CMakeLists.txt b/src/test/function_test/bulk_load/CMakeLists.txt index ae1fd559b6f..724c85c6589 100644 --- a/src/test/function_test/bulk_load/CMakeLists.txt +++ b/src/test/function_test/bulk_load/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "bulk_load_test") +set(MY_PROJ_NAME bulk_load_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -30,19 +30,18 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_client dsn_replication_common - dsn_utils - dsn.block_service.local - pegasus_client_static - gtest + dsn_runtime sasl2 gssapi_krb5 krb5 + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + pegasus_client_static + dsn_utils function_test_utils test_utils - rocksdb - lz4 - zstd - snappy) + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/detect_hotspot/CMakeLists.txt b/src/test/function_test/detect_hotspot/CMakeLists.txt index 8a8070d854f..ae73dc3b9ce 100644 --- a/src/test/function_test/detect_hotspot/CMakeLists.txt +++ b/src/test/function_test/detect_hotspot/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "detect_hotspot_test") +set(MY_PROJ_NAME detect_hotspot_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -30,14 +30,15 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_client dsn_replication_common - dsn_utils - pegasus_client_static - gtest + dsn_runtime sasl2 gssapi_krb5 krb5 function_test_utils - test_utils) + pegasus_client_static + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/detect_hotspot/test_detect_hotspot.cpp b/src/test/function_test/detect_hotspot/test_detect_hotspot.cpp index 659d3790530..596ebda5f1c 100644 --- a/src/test/function_test/detect_hotspot/test_detect_hotspot.cpp +++ b/src/test/function_test/detect_hotspot/test_detect_hotspot.cpp @@ -25,7 +25,7 @@ #include #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "gtest/gtest.h" #include "include/pegasus/client.h" #include "include/pegasus/error.h" diff --git a/src/test/function_test/partition_split/CMakeLists.txt b/src/test/function_test/partition_split/CMakeLists.txt index b2cff9f6063..3206b0c92cc 100644 --- a/src/test/function_test/partition_split/CMakeLists.txt +++ b/src/test/function_test/partition_split/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "partition_split_test") +set(MY_PROJ_NAME partition_split_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -28,17 +28,17 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_client - dsn_replication_common - dsn_utils - pegasus_client_static - gtest - sasl2 - gssapi_krb5 - krb5 - function_test_utils - test_utils - ) + dsn_client + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + function_test_utils + pegasus_client_static + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/partition_split/test_split.cpp b/src/test/function_test/partition_split/test_split.cpp index 42942121b7f..2b011746de7 100644 --- a/src/test/function_test/partition_split/test_split.cpp +++ b/src/test/function_test/partition_split/test_split.cpp @@ -30,7 +30,7 @@ #include "client/partition_resolver.h" #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "gtest/gtest.h" #include "include/pegasus/client.h" #include "metadata_types.h" diff --git a/src/test/function_test/recovery/CMakeLists.txt b/src/test/function_test/recovery/CMakeLists.txt index a13d12734b2..cb73081870d 100644 --- a/src/test/function_test/recovery/CMakeLists.txt +++ b/src/test/function_test/recovery/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "recovery_test") +set(MY_PROJ_NAME recovery_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -30,14 +30,15 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_client dsn_replication_common - dsn_utils - pegasus_client_static - gtest + dsn_runtime sasl2 gssapi_krb5 krb5 function_test_utils - test_utils) + pegasus_client_static + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/restore/CMakeLists.txt b/src/test/function_test/restore/CMakeLists.txt index 18b0ad44469..0d3d2564f0d 100644 --- a/src/test/function_test/restore/CMakeLists.txt +++ b/src/test/function_test/restore/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "restore_test") +set(MY_PROJ_NAME restore_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -30,14 +30,15 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_client dsn_replication_common - dsn_utils - gtest + dsn_runtime sasl2 gssapi_krb5 krb5 function_test_utils pegasus_client_static - test_utils) + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/restore/test_restore.cpp b/src/test/function_test/restore/test_restore.cpp index e99ef62ea85..c94553b6cb6 100644 --- a/src/test/function_test/restore/test_restore.cpp +++ b/src/test/function_test/restore/test_restore.cpp @@ -34,7 +34,7 @@ #include "base/pegasus_const.h" #include "client/partition_resolver.h" #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "gtest/gtest.h" #include "test/function_test/utils/global_env.h" #include "test/function_test/utils/test_util.h" diff --git a/src/test/function_test/throttle/CMakeLists.txt b/src/test/function_test/throttle/CMakeLists.txt index 70460d0c5de..5134b7901c3 100644 --- a/src/test/function_test/throttle/CMakeLists.txt +++ b/src/test/function_test/throttle/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "throttle_test") +set(MY_PROJ_NAME throttle_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -28,17 +28,17 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_client - dsn_replication_common - dsn_utils - pegasus_client_static - gtest - sasl2 - gssapi_krb5 - krb5 - function_test_utils - test_utils - ) + dsn_client + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + function_test_utils + pegasus_client_static + dsn_utils + test_utils + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/function_test/throttle/test_throttle.cpp b/src/test/function_test/throttle/test_throttle.cpp index d7e5f61b516..d77a549cc67 100644 --- a/src/test/function_test/throttle/test_throttle.cpp +++ b/src/test/function_test/throttle/test_throttle.cpp @@ -28,7 +28,7 @@ #include "client/partition_resolver.h" #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "gtest/gtest.h" #include "include/pegasus/client.h" #include "pegasus/error.h" diff --git a/src/test/kill_test/CMakeLists.txt b/src/test/kill_test/CMakeLists.txt index df974487374..ba57957615e 100644 --- a/src/test/kill_test/CMakeLists.txt +++ b/src/test/kill_test/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "pegasus_kill_test") +set(MY_PROJ_NAME pegasus_kill_test) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -28,17 +28,17 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - pegasus_base - pegasus_client_static - dsn_client - dsn_replication_common - dsn_dist_cmd - dsn_runtime - dsn_utils - sasl2 - gssapi_krb5 - krb5 - ) + dsn_client + dsn_replication_common + dsn_dist_cmd + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + function_test_utils + pegasus_client_static + dsn_utils) + set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini") set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/test/kill_test/kill_testor.cpp b/src/test/kill_test/kill_testor.cpp index 6c1019aef18..4442b358f7b 100644 --- a/src/test/kill_test/kill_testor.cpp +++ b/src/test/kill_test/kill_testor.cpp @@ -29,7 +29,7 @@ #include "base/pegasus_const.h" #include "client/replication_ddl_client.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication_other_types.h" #include "kill_testor.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/test/kill_test/partition_kill_testor.cpp b/src/test/kill_test/partition_kill_testor.cpp index 271cc64c5b3..656930ad041 100644 --- a/src/test/kill_test/partition_kill_testor.cpp +++ b/src/test/kill_test/partition_kill_testor.cpp @@ -25,7 +25,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "dsn.layer2_types.h" #include "partition_kill_testor.h" #include "remote_cmd/remote_command.h" diff --git a/src/test/pressure_test/CMakeLists.txt b/src/test/pressure_test/CMakeLists.txt index 42e29b73668..594b8fc2a33 100644 --- a/src/test/pressure_test/CMakeLists.txt +++ b/src/test/pressure_test/CMakeLists.txt @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -set(MY_PROJ_NAME "pegasus_pressureclient") +set(MY_PROJ_NAME pegasus_pressureclient) project(${MY_PROJ_NAME} C CXX) # Source files under CURRENT project directory will be automatically included. @@ -28,12 +28,15 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - pegasus_client_static - dsn_utils - sasl2 - gssapi_krb5 - krb5 - ) + dsn_client + dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 + function_test_utils + pegasus_client_static + dsn_utils) set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config-pressure.ini") diff --git a/src/tools/mutation_log_tool.cpp b/src/tools/mutation_log_tool.cpp index b68a4979b53..bbedbfc473d 100644 --- a/src/tools/mutation_log_tool.cpp +++ b/src/tools/mutation_log_tool.cpp @@ -31,7 +31,7 @@ #include #include "common/fs_manager.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "consensus_types.h" #include "dsn.layer2_types.h" #include "fmt/core.h" diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 38390f0ed62..ce7adebd622 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -33,6 +33,7 @@ set(MY_BOOST_LIBS Boost::system Boost::filesystem) set(MY_PROJ_LIBS dsn_http + dsn_replication_common rocksdb lz4 zstd @@ -41,12 +42,7 @@ set(MY_PROJ_LIBS # Extra files that will be installed set(MY_BINPLACES "") -if (APPLE) - dsn_add_static_library() - target_link_libraries(${MY_PROJ_NAME} PRIVATE dsn_http) -else() - dsn_add_shared_library() -endif() +dsn_add_static_library() add_subdirectory(long_adder_bench) add_subdirectory(test) diff --git a/src/utils/distributed_lock_service.h b/src/utils/distributed_lock_service.h index 0a8749021c1..0d50c71d07e 100644 --- a/src/utils/distributed_lock_service.h +++ b/src/utils/distributed_lock_service.h @@ -33,7 +33,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "runtime/rpc/serialization.h" #include "runtime/rpc/rpc_stream.h" #include "runtime/serverlet.h" diff --git a/src/utils/filesystem.cpp b/src/utils/filesystem.cpp index 0ebe07ef772..d0d43966403 100644 --- a/src/utils/filesystem.cpp +++ b/src/utils/filesystem.cpp @@ -569,6 +569,17 @@ std::string path_combine(const std::string &path1, const std::string &path2) return npath; } +std::string concat_path_unix_style(const std::string &prefix, const std::string &postfix) +{ + size_t pos1 = prefix.size(); // last_valid_pos + 1 + while (pos1 > 0 && prefix[pos1 - 1] == '/') + pos1--; + size_t pos2 = 0; // first non '/' position + while (pos2 < postfix.size() && postfix[pos2] == '/') + pos2++; + return prefix.substr(0, pos1) + "/" + postfix.substr(pos2); +} + bool get_current_directory(std::string &path) { bool succ; diff --git a/src/utils/filesystem.h b/src/utils/filesystem.h index 2142d1be1a8..78f99e64120 100644 --- a/src/utils/filesystem.h +++ b/src/utils/filesystem.h @@ -75,8 +75,11 @@ std::string remove_file_name(const std::string &path); std::string get_file_name(const std::string &path); +// TODO(yingchun): maybe one the following 2 functions are duplicated and can be removed. std::string path_combine(const std::string &path1, const std::string &path2); +std::string concat_path_unix_style(const std::string &prefix, const std::string &postfix); + typedef std::function ftw_handler; bool file_tree_walk(const std::string &dirpath, ftw_handler handler, bool recursive = true); diff --git a/src/utils/gpid.cpp b/src/utils/gpid.cpp index 1d3bb3e27c9..f583574debf 100644 --- a/src/utils/gpid.cpp +++ b/src/utils/gpid.cpp @@ -26,8 +26,7 @@ #include -#include "common/gpid.h" -#include "utils/fixed_size_buffer_pool.h" +#include "utils/gpid.h" namespace dsn { @@ -36,11 +35,4 @@ bool gpid::parse_from(const char *str) return sscanf(str, "%d.%d", &_value.u.app_id, &_value.u.partition_index) == 2; } -static __thread fixed_size_buffer_pool<8, 64> bf; -const char *gpid::to_string() const -{ - char *b = bf.next(); - snprintf(b, bf.get_chunk_size(), "%d.%d", _value.u.app_id, _value.u.partition_index); - return b; -} -} +} // namespace dsn diff --git a/src/common/gpid.h b/src/utils/gpid.h similarity index 91% rename from src/common/gpid.h rename to src/utils/gpid.h index 183aae40dc3..3f52cd33af2 100644 --- a/src/common/gpid.h +++ b/src/utils/gpid.h @@ -30,6 +30,7 @@ #include #include +#include "utils/fixed_size_buffer_pool.h" #include "utils/fmt_utils.h" namespace dsn { @@ -67,7 +68,13 @@ class gpid bool parse_from(const char *str); - const char *to_string() const; + const char *to_string() const + { + static __thread fixed_size_buffer_pool<8, 64> bf; + char *b = bf.next(); + snprintf(b, bf.get_chunk_size(), "%d.%d", _value.u.app_id, _value.u.partition_index); + return b; + } // for serialization in thrift format uint32_t read(::apache::thrift::protocol::TProtocol *iprot); diff --git a/src/utils/long_adder_bench/CMakeLists.txt b/src/utils/long_adder_bench/CMakeLists.txt index 71568c61aee..86568dda1e1 100644 --- a/src/utils/long_adder_bench/CMakeLists.txt +++ b/src/utils/long_adder_bench/CMakeLists.txt @@ -29,6 +29,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils rocksdb lz4 diff --git a/src/utils/metrics.cpp b/src/utils/metrics.cpp index 0a17bc1e73b..fab089588f1 100644 --- a/src/utils/metrics.cpp +++ b/src/utils/metrics.cpp @@ -240,12 +240,13 @@ metric_entity_prototype::~metric_entity_prototype() {} metrics_http_service::metrics_http_service(metric_registry *registry) : _registry(registry) { - register_handler("metrics", - std::bind(&metrics_http_service::get_metrics_handler, - this, - std::placeholders::_1, - std::placeholders::_2), - "ip:port/metrics"); + // undefined reference to `dsn::http_service::register_handler + // register_handler("metrics", + // std::bind(&metrics_http_service::get_metrics_handler, + // this, + // std::placeholders::_1, + // std::placeholders::_2), + // "ip:port/metrics"); } namespace { diff --git a/src/utils/test/CMakeLists.txt b/src/utils/test/CMakeLists.txt index 8502cabb767..dbdcce28bee 100644 --- a/src/utils/test/CMakeLists.txt +++ b/src/utils/test/CMakeLists.txt @@ -32,6 +32,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils gtest test_utils diff --git a/src/utils/test/fmt_logging_test.cpp b/src/utils/test/fmt_logging_test.cpp index 95e7d0dfd97..e135d7cdf2e 100644 --- a/src/utils/test/fmt_logging_test.cpp +++ b/src/utils/test/fmt_logging_test.cpp @@ -27,7 +27,7 @@ #include #include -#include "common/gpid.h" +#include "utils/gpid.h" #include "common/replication.codes.h" #include "gtest/gtest.h" #include "runtime/task/task_code.h" diff --git a/src/utils/test/nth_element_bench/CMakeLists.txt b/src/utils/test/nth_element_bench/CMakeLists.txt index 3aae31e4a6a..c4e82082b4b 100644 --- a/src/utils/test/nth_element_bench/CMakeLists.txt +++ b/src/utils/test/nth_element_bench/CMakeLists.txt @@ -29,6 +29,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils rocksdb lz4 diff --git a/src/zookeeper/CMakeLists.txt b/src/zookeeper/CMakeLists.txt index c6d99a55d93..5ebfcd0e284 100644 --- a/src/zookeeper/CMakeLists.txt +++ b/src/zookeeper/CMakeLists.txt @@ -34,7 +34,9 @@ set(MY_PROJ_SRC "") # "GLOB" for non-recursive search set(MY_SRC_SEARCH_MODE "GLOB") -set(MY_PROJ_LIBS zookeeper hashtable) +set(MY_PROJ_LIBS + zookeeper + hashtable) # Extra files that will be installed set(MY_BINPLACES "") diff --git a/src/zookeeper/lock_types.h b/src/zookeeper/lock_types.h index d368fc514d2..4917bff3b1a 100644 --- a/src/zookeeper/lock_types.h +++ b/src/zookeeper/lock_types.h @@ -30,7 +30,7 @@ #include "utils/error_code.h" #include "utils/threadpool_code.h" #include "runtime/task/task_code.h" -#include "common/gpid.h" +#include "utils/gpid.h" #include "utils/distributed_lock_service.h" namespace dsn { diff --git a/src/zookeeper/test/CMakeLists.txt b/src/zookeeper/test/CMakeLists.txt index 7dabd1faf5d..453c1f79394 100644 --- a/src/zookeeper/test/CMakeLists.txt +++ b/src/zookeeper/test/CMakeLists.txt @@ -36,13 +36,18 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn.replication.zookeeper_provider dsn_runtime + sasl2 + gssapi_krb5 + krb5 + dsn_utils + dsn_http zookeeper hashtable gtest rocksdb lz4 - zstd - snappy) + snappy + zstd) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index fb628986a15..7a2c10379b4 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -448,6 +448,7 @@ set(ROCKSDB_OPTIONS -DWITH_TESTS=OFF -DWITH_GFLAGS=OFF -DUSE_RTTI=ON + -DROCKSDB_BUILD_SHARED=OFF -DCMAKE_BUILD_TYPE=Release -DWITH_JEMALLOC=${USE_JEMALLOC} -DJEMALLOC_ROOT_DIR=${TP_OUTPUT}