From 4c6a00309c6a62a32bcbcc9c356e41cd38bea0bf Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Mon, 18 Dec 2023 18:10:57 +0800 Subject: [PATCH] utils --- run.sh | 3 +- src/aio/CMakeLists.txt | 3 ++ src/aio/test/CMakeLists.txt | 4 +++ src/base/test/CMakeLists.txt | 11 ++++--- src/block_service/CMakeLists.txt | 2 +- src/block_service/test/CMakeLists.txt | 7 +++-- src/client/test/CMakeLists.txt | 3 ++ src/common/test/CMakeLists.txt | 3 ++ src/failure_detector/test/CMakeLists.txt | 3 ++ src/geo/bench/CMakeLists.txt | 4 +++ src/geo/test/CMakeLists.txt | 4 +++ src/http/test/CMakeLists.txt | 3 ++ src/meta/CMakeLists.txt | 3 ++ src/meta/test/CMakeLists.txt | 6 ++-- .../test/balancer_simulator/CMakeLists.txt | 5 +++- src/meta/test/meta_state/CMakeLists.txt | 3 ++ src/nfs/test/CMakeLists.txt | 12 +++++--- src/perf_counter/test/CMakeLists.txt | 6 +++- src/redis_protocol/proxy_ut/CMakeLists.txt | 12 +++++--- src/replica/CMakeLists.txt | 5 +++- src/replica/backup/test/CMakeLists.txt | 3 ++ src/replica/bulk_load/test/CMakeLists.txt | 3 ++ .../duplication/duplication_pipeline.cpp | 12 ++------ src/replica/duplication/mutation_duplicator.h | 15 ++++------ src/replica/duplication/test/CMakeLists.txt | 21 ++++++++++---- .../duplication/test/duplication_test_base.h | 6 ++-- src/replica/split/test/CMakeLists.txt | 3 ++ src/replica/storage/CMakeLists.txt | 2 +- src/replica/storage/simple_kv/CMakeLists.txt | 29 ++++++++++++++----- .../storage/simple_kv/test/CMakeLists.txt | 18 ++++++++++-- src/replica/test/CMakeLists.txt | 3 ++ src/replica/test/mock_utils.h | 3 +- src/runtime/CMakeLists.txt | 28 +++++++++++------- src/runtime/rpc/CMakeLists.txt | 1 + src/runtime/task/CMakeLists.txt | 1 + src/runtime/test/CMakeLists.txt | 7 ++++- src/sample/CMakeLists.txt | 9 +++++- src/server/pegasus_mutation_duplicator.cpp | 21 ++++---------- src/server/pegasus_mutation_duplicator.h | 3 ++ src/server/test/CMakeLists.txt | 13 +++++---- .../test/pegasus_mutation_duplicator_test.cpp | 10 +++---- src/shell/CMakeLists.txt | 5 +++- src/test/bench_test/CMakeLists.txt | 9 +++--- .../backup_restore/CMakeLists.txt | 9 +++--- .../function_test/base_api/CMakeLists.txt | 24 +++++++-------- .../function_test/bulk_load/CMakeLists.txt | 14 ++++----- .../detect_hotspot/CMakeLists.txt | 11 +++---- .../partition_split/CMakeLists.txt | 24 +++++++-------- .../function_test/recovery/CMakeLists.txt | 11 +++---- src/test/function_test/restore/CMakeLists.txt | 9 +++--- .../function_test/throttle/CMakeLists.txt | 24 +++++++-------- src/test/kill_test/CMakeLists.txt | 24 +++++++-------- src/test/pressure_test/CMakeLists.txt | 8 +++-- src/utils/long_adder_bench/CMakeLists.txt | 3 ++ src/utils/test/CMakeLists.txt | 3 ++ .../test/nth_element_bench/CMakeLists.txt | 3 ++ src/zookeeper/test/CMakeLists.txt | 3 ++ 57 files changed, 312 insertions(+), 185 deletions(-) diff --git a/run.sh b/run.sh index 12f34e1815..05023b2df5 100755 --- a/run.sh +++ b/run.sh @@ -326,10 +326,9 @@ function run_build() if [ ! -z "${IWYU}" ]; then make $MAKE_OPTIONS 2> iwyu.out else - make pegasus_server $MAKE_OPTIONS + make $MAKE_OPTIONS # pegasus_shell # pegasus_server -# pegasus_unit_test # make install fi exit_if_fail $? diff --git a/src/aio/CMakeLists.txt b/src/aio/CMakeLists.txt index 3a27fbe01a..4db5b0d4c4 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 2eb4371467..b8099536c2 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/test/CMakeLists.txt b/src/base/test/CMakeLists.txt index b7e1c29d0e..7fae9d7d82 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/CMakeLists.txt b/src/block_service/CMakeLists.txt index c264d7c8bd..0ce357ce1c 100644 --- a/src/block_service/CMakeLists.txt +++ b/src/block_service/CMakeLists.txt @@ -39,4 +39,4 @@ dsn_add_static_library() add_subdirectory(hdfs) add_subdirectory(local) -#add_subdirectory(test) +add_subdirectory(test) diff --git a/src/block_service/test/CMakeLists.txt b/src/block_service/test/CMakeLists.txt index a5c1769f71..70a5534df2 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 @@ -35,9 +38,7 @@ set(MY_PROJ_LIBS rocksdb lz4 zstd - snappy - ssl - crypto) + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/client/test/CMakeLists.txt b/src/client/test/CMakeLists.txt index 60f3762760..c0a5d0430a 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/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index b319eb59d6..72c1cb1acb 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -30,6 +30,9 @@ set(MY_PROJ_LIBS dsn_http dsn_replication_common dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils gtest rocksdb diff --git a/src/failure_detector/test/CMakeLists.txt b/src/failure_detector/test/CMakeLists.txt index e8b6f30fc2..e79b20009f 100644 --- a/src/failure_detector/test/CMakeLists.txt +++ b/src/failure_detector/test/CMakeLists.txt @@ -36,6 +36,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_meta_server dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_replica_server dsn.security dsn_nfs diff --git a/src/geo/bench/CMakeLists.txt b/src/geo/bench/CMakeLists.txt index a0b2844b1b..4601455723 100644 --- a/src/geo/bench/CMakeLists.txt +++ b/src/geo/bench/CMakeLists.txt @@ -28,6 +28,10 @@ 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 diff --git a/src/geo/test/CMakeLists.txt b/src/geo/test/CMakeLists.txt index 76b3c1779a..3cf968a692 100644 --- a/src/geo/test/CMakeLists.txt +++ b/src/geo/test/CMakeLists.txt @@ -28,6 +28,10 @@ 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 diff --git a/src/http/test/CMakeLists.txt b/src/http/test/CMakeLists.txt index e04b952ded..9b2d9ad8ca 100644 --- a/src/http/test/CMakeLists.txt +++ b/src/http/test/CMakeLists.txt @@ -24,6 +24,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils curl gtest diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index 3423f1af57..2da3645314 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -43,6 +43,9 @@ set(MY_PROJ_LIBS dsn_dist_cmd dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_ranger dsn.security dsn.task diff --git a/src/meta/test/CMakeLists.txt b/src/meta/test/CMakeLists.txt index 2855419556..fad8c70498 100644 --- a/src/meta/test/CMakeLists.txt +++ b/src/meta/test/CMakeLists.txt @@ -52,8 +52,10 @@ set(MY_PROJ_LIBS dsn_aio dsn_http dsn_runtime - zookeeper - hashtable + dsn_utils + sasl2 + gssapi_krb5 + krb5 gtest rocksdb lz4 diff --git a/src/meta/test/balancer_simulator/CMakeLists.txt b/src/meta/test/balancer_simulator/CMakeLists.txt index 16155b95eb..3afac77775 100644 --- a/src/meta/test/balancer_simulator/CMakeLists.txt +++ b/src/meta/test/balancer_simulator/CMakeLists.txt @@ -44,8 +44,11 @@ set(MY_PROJ_LIBS dsn.replication.zookeeper_provider zookeeper hashtable - dsn_utils dsn_runtime + dsn_utils + sasl2 + gssapi_krb5 + krb5 gtest rocksdb lz4 diff --git a/src/meta/test/meta_state/CMakeLists.txt b/src/meta/test/meta_state/CMakeLists.txt index 219d3901b8..b0fce629aa 100644 --- a/src/meta/test/meta_state/CMakeLists.txt +++ b/src/meta/test/meta_state/CMakeLists.txt @@ -39,6 +39,9 @@ set(MY_PROJ_LIBS dsn_replica_server dsn_replication_common dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils gtest zookeeper diff --git a/src/nfs/test/CMakeLists.txt b/src/nfs/test/CMakeLists.txt index 4a22ce4867..a1e73bf622 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/perf_counter/test/CMakeLists.txt b/src/perf_counter/test/CMakeLists.txt index f1ff42934a..0c7f9ef8e1 100644 --- a/src/perf_counter/test/CMakeLists.txt +++ b/src/perf_counter/test/CMakeLists.txt @@ -36,9 +36,13 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_meta_server dsn_replication_common + dsn_runtime + dsn_aio dsn_utils + sasl2 + gssapi_krb5 + krb5 gtest - dsn_runtime rocksdb lz4 zstd diff --git a/src/redis_protocol/proxy_ut/CMakeLists.txt b/src/redis_protocol/proxy_ut/CMakeLists.txt index 180dbaa98f..9dcecd6473 100644 --- a/src/redis_protocol/proxy_ut/CMakeLists.txt +++ b/src/redis_protocol/proxy_ut/CMakeLists.txt @@ -31,7 +31,6 @@ set(MY_BOOST_LIBS Boost::system Boost::filesystem) set(MY_PROJ_LIBS pegasus.rproxylib - dsn_utils absl::flat_hash_set absl::strings pegasus_geo_lib @@ -39,12 +38,17 @@ set(MY_PROJ_LIBS s2 pegasus_client_static dsn_client - test_utils + dsn_runtime + dsn_aio + dsn_utils + sasl2 + gssapi_krb5 + krb5 + gtest rocksdb lz4 zstd - snappy - gtest) + snappy) set(MY_BINPLACES "config.ini" "run.sh") diff --git a/src/replica/CMakeLists.txt b/src/replica/CMakeLists.txt index a4b295f479..e0a263f67f 100644 --- a/src/replica/CMakeLists.txt +++ b/src/replica/CMakeLists.txt @@ -67,6 +67,9 @@ set(MY_PROJ_LIBS dsn_dist_cmd dsn_http dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_aio dsn_meta_server rocksdb @@ -82,7 +85,7 @@ set(MY_BINPLACES "") dsn_add_static_library() -#add_subdirectory(duplication/test) +add_subdirectory(duplication/test) add_subdirectory(backup/test) add_subdirectory(bulk_load/test) add_subdirectory(split/test) diff --git a/src/replica/backup/test/CMakeLists.txt b/src/replica/backup/test/CMakeLists.txt index 09505b2de9..575dd18bd4 100644 --- a/src/replica/backup/test/CMakeLists.txt +++ b/src/replica/backup/test/CMakeLists.txt @@ -26,6 +26,9 @@ set(MY_PROJ_LIBS dsn_meta_server dsn_nfs dsn_dist_cmd dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_meta_server dsn_replication_common dsn.replication.zookeeper_provider diff --git a/src/replica/bulk_load/test/CMakeLists.txt b/src/replica/bulk_load/test/CMakeLists.txt index 717b20414c..6e57bee7c7 100644 --- a/src/replica/bulk_load/test/CMakeLists.txt +++ b/src/replica/bulk_load/test/CMakeLists.txt @@ -23,6 +23,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_meta_server dsn_replica_server dsn.security diff --git a/src/replica/duplication/duplication_pipeline.cpp b/src/replica/duplication/duplication_pipeline.cpp index 8ce736f517..63b689f53c 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/mutation_duplicator.h b/src/replica/duplication/mutation_duplicator.h index b1c29e00fa..2abace416f 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/test/CMakeLists.txt b/src/replica/duplication/test/CMakeLists.txt index acfeec4c22..31b7770387 100644 --- a/src/replica/duplication/test/CMakeLists.txt +++ b/src/replica/duplication/test/CMakeLists.txt @@ -22,20 +22,29 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_utils + dsn_replica_server + dsn.block_service + dsn.block_service.hdfs + dsn.block_service.local + dsn_nfs + dsn_dist_cmd dsn_aio dsn_http - dsn_meta_server dsn_ranger - dsn_replica_server + dsn_runtime + dsn_meta_server + sasl2 + gssapi_krb5 + krb5 dsn.replication.zookeeper_provider + zookeeper + hashtable dsn_replication_common dsn.rpc dsn.failure_detector - zookeeper - hashtable - gtest + dsn_utils test_utils + gtest rocksdb lz4 zstd diff --git a/src/replica/duplication/test/duplication_test_base.h b/src/replica/duplication/test/duplication_test_base.h index eb914f38e0..de3aba1851 100644 --- a/src/replica/duplication/test/duplication_test_base.h +++ b/src/replica/duplication/test/duplication_test_base.h @@ -34,9 +34,9 @@ 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/split/test/CMakeLists.txt b/src/replica/split/test/CMakeLists.txt index 1e8dc8f062..b21c989311 100644 --- a/src/replica/split/test/CMakeLists.txt +++ b/src/replica/split/test/CMakeLists.txt @@ -23,6 +23,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_meta_server dsn_replica_server dsn.security diff --git a/src/replica/storage/CMakeLists.txt b/src/replica/storage/CMakeLists.txt index 991ba40ef2..e140712485 100644 --- a/src/replica/storage/CMakeLists.txt +++ b/src/replica/storage/CMakeLists.txt @@ -22,4 +22,4 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -#add_subdirectory(simple_kv) +add_subdirectory(simple_kv) diff --git a/src/replica/storage/simple_kv/CMakeLists.txt b/src/replica/storage/simple_kv/CMakeLists.txt index 5d72235f5d..f4b232d51a 100644 --- a/src/replica/storage/simple_kv/CMakeLists.txt +++ b/src/replica/storage/simple_kv/CMakeLists.txt @@ -38,21 +38,34 @@ set(MY_PROJ_SRC ${SIMPLE_KV_THRIFT_SRCS}) set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - dsn_aio - dsn_http - dsn.block_service - dsn_dist_cmd 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 - snappy - pegasus_base - dsn_replication_common) + snappy) set(MY_BOOST_LIBS Boost::system Boost::filesystem) diff --git a/src/replica/storage/simple_kv/test/CMakeLists.txt b/src/replica/storage/simple_kv/test/CMakeLists.txt index 0bce41b712..6b7ba271a6 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/test/CMakeLists.txt b/src/replica/test/CMakeLists.txt index b248faa907..c61abdcabf 100644 --- a/src/replica/test/CMakeLists.txt +++ b/src/replica/test/CMakeLists.txt @@ -36,6 +36,9 @@ 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.security diff --git a/src/replica/test/mock_utils.h b/src/replica/test/mock_utils.h index bf2e894002..00a48a0be0 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/runtime/CMakeLists.txt b/src/runtime/CMakeLists.txt index d5757717ac..f4b22910cd 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,18 @@ 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_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/rpc/CMakeLists.txt b/src/runtime/rpc/CMakeLists.txt index 08de0852f6..a740e995d7 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/task/CMakeLists.txt b/src/runtime/task/CMakeLists.txt index ad09763cf6..edc6ad0415 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 e513d41b9d..8dbf69806c 100644 --- a/src/runtime/test/CMakeLists.txt +++ b/src/runtime/test/CMakeLists.txt @@ -24,14 +24,17 @@ 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 @@ -43,6 +46,8 @@ set(MY_PROJ_LIBS dsn.block_service.hdfs dsn.block_service.local dsn.failure_detector + dsn_utils + gtest rocksdb lz4 zstd diff --git a/src/sample/CMakeLists.txt b/src/sample/CMakeLists.txt index 42c09456e0..43e68a1f77 100644 --- a/src/sample/CMakeLists.txt +++ b/src/sample/CMakeLists.txt @@ -24,8 +24,15 @@ set(MY_PROJ_LIBS pegasus_client_static dsn_client dsn_replication_common + dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_utils - rocksdb) + rocksdb + lz4 + zstd + snappy) set(MY_BOOST_LIBS Boost::filesystem Boost::system) diff --git a/src/server/pegasus_mutation_duplicator.cpp b/src/server/pegasus_mutation_duplicator.cpp index 3553bcfc79..6a04326f3f 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 2d81a6a37c..69d7e43787 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/test/CMakeLists.txt b/src/server/test/CMakeLists.txt index a9f52097e9..281171744f 100644 --- a/src/server/test/CMakeLists.txt +++ b/src/server/test/CMakeLists.txt @@ -37,6 +37,9 @@ set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_runtime + sasl2 + gssapi_krb5 + krb5 dsn_meta_server dsn_replica_server dsn.security @@ -53,15 +56,15 @@ set(MY_PROJ_LIBS zookeeper hashtable dsn_utils - rocksdb - lz4 - zstd - snappy pegasus_client_static event pegasus_base gtest - gmock) + gmock + rocksdb + lz4 + zstd + snappy) add_definitions(-DPEGASUS_UNIT_TEST) add_definitions(-DENABLE_FAIL) diff --git a/src/server/test/pegasus_mutation_duplicator_test.cpp b/src/server/test/pegasus_mutation_duplicator_test.cpp index 8ddbd38b4b..c94db3a91f 100644 --- a/src/server/test/pegasus_mutation_duplicator_test.cpp +++ b/src/server/test/pegasus_mutation_duplicator_test.cpp @@ -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/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index 342c3f56c1..a3c7e01430 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -29,13 +29,16 @@ set(MY_SRC_SEARCH_MODE "GLOB_RECURSE") set(MY_PROJ_LIBS dsn_runtime + dsn_meta_server + sasl2 + gssapi_krb5 + krb5 dsn_ranger pegasus_base dsn.replication.tool dsn_replica_server dsn_nfs dsn_aio - dsn_meta_server dsn_replication_common dsn.block_service dsn.block_service.hdfs diff --git a/src/test/bench_test/CMakeLists.txt b/src/test/bench_test/CMakeLists.txt index d0c2fd06be..32e4d354a1 100644 --- a/src/test/bench_test/CMakeLists.txt +++ b/src/test/bench_test/CMakeLists.txt @@ -31,14 +31,15 @@ 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 41a6c6ed2b..a41b6e7939 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 3e688f3a17..ca08fab04b 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 ae1fd559b6..a1af8c644e 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,15 @@ 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 function_test_utils + pegasus_client_static + dsn_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 8a8070d854..ae73dc3b9c 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/partition_split/CMakeLists.txt b/src/test/function_test/partition_split/CMakeLists.txt index b2cff9f606..3206b0c92c 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/recovery/CMakeLists.txt b/src/test/function_test/recovery/CMakeLists.txt index a13d12734b..cb73081870 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 18b0ad4446..0d3d2564f0 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/throttle/CMakeLists.txt b/src/test/function_test/throttle/CMakeLists.txt index 70460d0c5d..5134b7901c 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/kill_test/CMakeLists.txt b/src/test/kill_test/CMakeLists.txt index df97448737..ba57957615 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/pressure_test/CMakeLists.txt b/src/test/pressure_test/CMakeLists.txt index b8b806b869..594b8fc2a3 100644 --- a/src/test/pressure_test/CMakeLists.txt +++ b/src/test/pressure_test/CMakeLists.txt @@ -28,13 +28,15 @@ set(MY_PROJ_SRC "") set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS - pegasus_client_static dsn_client dsn_replication_common - dsn_utils + dsn_runtime sasl2 gssapi_krb5 - krb5) + krb5 + function_test_utils + pegasus_client_static + dsn_utils) set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config-pressure.ini") diff --git a/src/utils/long_adder_bench/CMakeLists.txt b/src/utils/long_adder_bench/CMakeLists.txt index 71568c61ae..86568dda1e 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/test/CMakeLists.txt b/src/utils/test/CMakeLists.txt index 8502cabb76..dbdcce28be 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/nth_element_bench/CMakeLists.txt b/src/utils/test/nth_element_bench/CMakeLists.txt index 3aae31e4a6..c4e82082b4 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/test/CMakeLists.txt b/src/zookeeper/test/CMakeLists.txt index 4e722e8770..453c1f7939 100644 --- a/src/zookeeper/test/CMakeLists.txt +++ b/src/zookeeper/test/CMakeLists.txt @@ -36,6 +36,9 @@ 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