Skip to content

Commit

Permalink
utils
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Dec 19, 2023
1 parent ef08ee6 commit 4c6a003
Show file tree
Hide file tree
Showing 57 changed files with 312 additions and 185 deletions.
3 changes: 1 addition & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?
Expand Down
3 changes: 3 additions & 0 deletions src/aio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_runtime
sasl2
gssapi_krb5
krb5
rocksdb
lz4
zstd
Expand Down
4 changes: 4 additions & 0 deletions src/aio/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions src/base/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/block_service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ dsn_add_static_library()

add_subdirectory(hdfs)
add_subdirectory(local)
#add_subdirectory(test)
add_subdirectory(test)
7 changes: 4 additions & 3 deletions src/block_service/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,9 +38,7 @@ set(MY_PROJ_LIBS
rocksdb
lz4
zstd
snappy
ssl
crypto)
snappy)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

Expand Down
3 changes: 3 additions & 0 deletions src/client/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ set(MY_PROJ_LIBS
dsn_client
dsn_replication_common
dsn_runtime
sasl2
gssapi_krb5
krb5
dsn_utils
gtest
rocksdb
Expand Down
3 changes: 3 additions & 0 deletions src/common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ set(MY_PROJ_LIBS
dsn_http
dsn_replication_common
dsn_runtime
sasl2
gssapi_krb5
krb5
dsn_utils
gtest
rocksdb
Expand Down
3 changes: 3 additions & 0 deletions src/failure_detector/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/geo/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/geo/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/http/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/meta/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/meta/test/balancer_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/meta/test/meta_state/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ set(MY_PROJ_LIBS
dsn_replica_server
dsn_replication_common
dsn_runtime
sasl2
gssapi_krb5
krb5
dsn_utils
gtest
zookeeper
Expand Down
12 changes: 8 additions & 4 deletions src/nfs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 5 additions & 1 deletion src/perf_counter/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/redis_protocol/proxy_ut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,24 @@ 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
event
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")

Expand Down
5 changes: 4 additions & 1 deletion src/replica/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/replica/backup/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/replica/bulk_load/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/replica/duplication/duplication_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ namespace dsn {

namespace replication {

// //
// mutation_duplicator //
// //

/*static*/ std::function<std::unique_ptr<mutation_duplicator>(
replica_base *, absl::string_view /*remote cluster*/, absl::string_view /*app*/)>
mutation_duplicator::creator;

// //
// load_mutation //
// //
Expand Down Expand Up @@ -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);
}

Expand Down
15 changes: 5 additions & 10 deletions src/replica/duplication/mutation_duplicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::unique_ptr<mutation_duplicator>(
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;
Expand All @@ -83,11 +78,11 @@ class mutation_duplicator : public replica_base
pipeline::environment _env;
};

inline std::unique_ptr<mutation_duplicator> 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<mutation_duplicator> 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
21 changes: 15 additions & 6 deletions src/replica/duplication/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/replica/duplication/test/duplication_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<mock_mutation_duplicator>(r);
};
// mutation_duplicator::creator = [](replica_base *r, absl::string_view, absl::string_view) {
// return std::make_unique<mock_mutation_duplicator>(r);
// };
stub->_duplication_sync_timer = std::make_unique<duplication_sync_timer>(stub.get());
}

Expand Down
Loading

0 comments on commit 4c6a003

Please sign in to comment.