Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Dec 15, 2023
1 parent 814ad97 commit ba042f1
Show file tree
Hide file tree
Showing 30 changed files with 128 additions and 79 deletions.
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ function run_build()
if [ ! -z "${IWYU}" ]; then
make $MAKE_OPTIONS 2> iwyu.out
else
make pegasus_geo_bench $MAKE_OPTIONS
make install
make dsn.meta.test $MAKE_OPTIONS
# make install
fi
exit_if_fail $?

Expand Down
4 changes: 3 additions & 1 deletion src/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_utils)
set(MY_PROJ_LIBS
dsn_utils
dsn_replication_common)

# Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
12 changes: 7 additions & 5 deletions src/geo/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ set(MY_PROJ_SRC "")
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
pegasus_geo_lib
pegasus_client_static
dsn_client
dsn_utils
dsn_http
dsn_replication_common
absl::flat_hash_set
absl::strings
s2testing
s2
thrift
dsn_replication_common
pegasus_client_static
rocksdb
lz4
zstd
snappy
pegasus_geo_lib
dsn_utils)
snappy)

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

Expand Down
7 changes: 3 additions & 4 deletions src/geo/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion src/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
13 changes: 7 additions & 6 deletions src/http/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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?<key>=<value>");
// 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?<key>=<value>");
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/http/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ set(MY_PROJ_LIBS
dsn_utils
curl
gtest
rocksdb
lz4
snappy
zstd
rocksdb)
zstd)

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

Expand Down
12 changes: 0 additions & 12 deletions src/meta/meta_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/meta/meta_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions src/meta/meta_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -445,16 +446,16 @@ error_code meta_service::start()
LOG_INFO("initialize backup handler");
_backup_handler = std::make_shared<backup_service>(
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<policy_context>(bs); });
}

_bulk_load_svc = std::make_unique<bulk_load_service>(
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 "
Expand Down
18 changes: 12 additions & 6 deletions src/meta/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,27 @@ 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
gtest
hdfs)
rocksdb
lz4
zstd
snappy)

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

Expand Down
3 changes: 2 additions & 1 deletion src/meta/test/meta_bulk_load_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -344,7 +345,7 @@ class bulk_load_service_test : public meta_test_base

// initialize bulk load service
_ms->_bulk_load_svc = std::make_unique<bulk_load_service>(
_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);

Expand Down
3 changes: 2 additions & 1 deletion src/meta/test/meta_partition_guardian_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -179,7 +180,7 @@ 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;
Expand Down
6 changes: 3 additions & 3 deletions src/meta/test/meta_state/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ set(MY_PROJ_SRC "")
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_aio
dsn_meta_server
dsn_aio
dsn_replica_server
dsn_replication_common
dsn_runtime
Expand All @@ -44,10 +44,10 @@ set(MY_PROJ_LIBS
zookeeper
hashtable
dsn.replication.zookeeper_provider
rocksdb
lz4
snappy
zstd
rocksdb)
zstd)

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

Expand Down
3 changes: 2 additions & 1 deletion src/meta/test/meta_test_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -71,7 +72,7 @@ void meta_test_base::SetUp()
_ms->_split_svc = std::make_unique<meta_split_service>(_ms.get());
ASSERT_TRUE(_ms->_split_svc);
_ms->_bulk_load_svc = std::make_unique<bulk_load_service>(
_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();

Expand Down
5 changes: 3 additions & 2 deletions src/meta/test/update_configuration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -224,7 +225,7 @@ 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;
Expand Down Expand Up @@ -303,7 +304,7 @@ 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;
Expand Down
3 changes: 2 additions & 1 deletion src/replica/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ set(MY_PROJ_LIBS
rocksdb
lz4
zstd
snappy)
snappy
zookeeper)

set(MY_BOOST_LIBS Boost::filesystem)

Expand Down
12 changes: 10 additions & 2 deletions src/replica/backup/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_meta_server
dsn_replica_server
dsn_replication_common
dsn_nfs
dsn_dist_cmd
dsn_runtime
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
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/ranger/ranger_resource_policy_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions src/runtime/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ set(MY_PROJ_LIBS
dsn_runtime
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
rocksdb
lz4
zstd
Expand Down
7 changes: 5 additions & 2 deletions src/sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ set(MY_SRC_SEARCH_MODE "GLOB")

# TODO(yingchun): should link pegasus_client shared lib only!
set(MY_PROJ_LIBS
rocksdb
pegasus_client_static)
pegasus_client_static
dsn_client
dsn_replication_common
dsn_utils
rocksdb)

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

Expand Down
Loading

0 comments on commit ba042f1

Please sign in to comment.