Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unit test failed and update rdsn #384

Merged
merged 5 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rdsn
Submodule rdsn updated 34 files
+2 −5 .travis.yml
+3 −0 include/dsn/dist/replication/replication.codes.h
+12 −2 include/dsn/dist/replication/replication_types.h
+2 −2 include/dsn/tool-api/http_server.h
+2 −2 include/dsn/utility/output_utils.h
+7 −6 src/core/core/output_utils.cpp
+13 −0 src/core/tests/output_utils_test.cpp
+1 −1 src/dist/http/CMakeLists.txt
+29 −22 src/dist/http/http_server.cpp
+2 −2 src/dist/http/server_info_http_services.cpp
+1 −1 src/dist/http/server_info_http_services.h
+1 −0 src/dist/http/test/CMakeLists.txt
+38 −0 src/dist/http/test/http_server_test.cpp
+32 −3 src/dist/replication/common/replication_types.cpp
+1 −0 src/dist/replication/lib/CMakeLists.txt
+1 −1 src/dist/replication/lib/duplication/test/CMakeLists.txt
+27 −2 src/dist/replication/lib/replica.h
+8 −1 src/dist/replication/lib/replica_context.cpp
+11 −0 src/dist/replication/lib/replica_context.h
+11 −3 src/dist/replication/lib/replica_init.cpp
+106 −0 src/dist/replication/lib/replica_split.cpp
+136 −12 src/dist/replication/lib/replica_stub.cpp
+38 −0 src/dist/replication/lib/replica_stub.h
+15 −31 src/dist/replication/meta_server/meta_http_service.cpp
+1 −1 src/dist/replication/meta_server/meta_http_service.h
+5 −1 src/dist/replication/replication.thrift
+1 −1 src/dist/replication/storage_engine/simple_kv/CMakeLists.txt
+2 −1 src/dist/replication/test/meta_test/unit_test/meta_http_service_test.cpp
+1 −2 src/dist/replication/test/replica_test/unit_test/CMakeLists.txt
+24 −1 src/dist/replication/test/replica_test/unit_test/mock_utils.h
+93 −0 src/dist/replication/test/replica_test/unit_test/replica_split_test.cpp
+1 −1 src/dist/replication/test/simple_kv/CMakeLists.txt
+1 −1 src/tests/dsn/CMakeLists.txt
+1 −1 thirdparty/build-thirdparty.sh
5 changes: 3 additions & 2 deletions src/server/config.min.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
type = meta
name = meta
ports = @META_PORT@
pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_META_STATE,THREAD_POOL_FD,THREAD_POOL_DLOCK
pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_META_STATE,THREAD_POOL_FD,THREAD_POOL_DLOCK,THREAD_POOL_LOCAL_SERVICE

[apps.replica]
type = replica
Expand Down Expand Up @@ -34,7 +34,7 @@
stderr_start_level = LOG_LEVEL_ERROR

[threadpool..default]
worker_count = 1
worker_count = 4
worker_priority = THREAD_xPRIORITY_NORMAL
partitioned = false

Expand Down Expand Up @@ -87,6 +87,7 @@
server_load_balancer_type = greedy_load_balancer
min_live_node_count_for_unfreeze = 1
cold_backup_disabled = false
recover_from_replica_server = false

[replication]
allow_non_idempotent_write = true
Expand Down
4 changes: 4 additions & 0 deletions src/server/test/pegasus_write_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class pegasus_write_service_test : public pegasus_server_test_base

void test_multi_remove()
{
dsn::fail::setup();

dsn::apps::multi_remove_request request;
dsn::apps::multi_remove_response response;

Expand Down Expand Up @@ -123,6 +125,8 @@ class pegasus_write_service_test : public pegasus_server_test_base
ASSERT_EQ(err, 0);
verify_response(response, 0, decree);
}

dsn::fail::teardown();
}

void test_batched_writes()
Expand Down
2 changes: 1 addition & 1 deletion src/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set(MY_PROJ_LIBS

set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")

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

SET(CMAKE_INSTALL_RPATH ".")
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Expand Down
2 changes: 1 addition & 1 deletion src/test/function_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ else()
set(MY_PROJ_LIBS ${MY_PROJ_LIBS} gtest)
endif()

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

set(MY_BINPLACES "config.ini" "run.sh")

Expand Down
27 changes: 17 additions & 10 deletions src/test/function_test/test_recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ class recovery_test : public testing::Test
protected:
virtual void SetUp()
{
// THREAD_POOL_META_SERVER worker count should be greater than 1
// This function test update 'distributed_lock_service_type' to
// 'distributed_lock_service_simple', which executes in threadpool THREAD_POOL_META_SERVER
// As a result, failure detection lock executes in this pool
// if worker count = 1, it will lead to ERR_TIMEOUT when execute 'ddl_client->do_recovery'

// 1. restart onebox, modify the config
chdir(global_env::instance()._pegasus_root.c_str());
system("./run.sh clear_onebox");

system("cp src/server/config-server.ini config-server-test-recovery.ini");
system("sed -i \"/^meta_state_service_type/c meta_state_service_type = "
system("cp src/server/config.min.ini config-server-test-recovery.ini");
system("sed -i \"/^\\s*meta_state_service_type/c meta_state_service_type = "
"meta_state_service_simple\" config-server-test-recovery.ini");
system("sed -i \"/^distributed_lock_service_type/c distributed_lock_service_type = "
system("sed -i \"/^\\s*distributed_lock_service_type/c distributed_lock_service_type = "
"distributed_lock_service_simple\" config-server-test-recovery.ini");
system("sed -i \"/^server_list/c server_list = @LOCAL_IP@:34601\" "
system("sed -i \"/^\\s*server_list/c server_list = @LOCAL_IP@:34601\" "
"config-server-test-recovery.ini");
system("sed -i \"/^perf_counter_enable_logging/c perf_counter_enable_logging = false\" "
system("sed -i \"/^\\s*perf_counter_enable_logging/c perf_counter_enable_logging = false\" "
"config-server-test-recovery.ini");

system("./run.sh start_onebox -m 1 -r 3 --config_path config-server-test-recovery.ini");
Expand Down Expand Up @@ -158,11 +164,12 @@ class recovery_test : public testing::Test
void config_meta_to_do_cold_recovery()
{
char command[512];
snprintf(command,
512,
"cd %s && sed -i \"/^recover_from_replica_server/c recover_from_replica_server = "
"true\" onebox/meta1/config.ini",
global_env::instance()._pegasus_root.c_str());
snprintf(
command,
512,
"cd %s && sed -i \"/^\\s*recover_from_replica_server/c recover_from_replica_server = "
"true\" onebox/meta1/config.ini",
global_env::instance()._pegasus_root.c_str());
system(command);
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/function_test/test_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class restore_test : public testing::Test

// modify the config to enable backup, and restart onebox
system("./run.sh clear_onebox");
system("cp src/server/config-server.ini config-server-test-restore.ini");
system("sed -i \"/^cold_backup_disabled/c cold_backup_disabled = false\" "
system("cp src/server/config.min.ini config-server-test-restore.ini");
system("sed -i \"/^\\s*cold_backup_disabled/c cold_backup_disabled = false\" "
"config-server-test-restore.ini");
std::string cmd = "sed -i \"/^cold_backup_root/c cold_backup_root = " + cluster_name;
std::string cmd = "sed -i \"/^\\s*cold_backup_root/c cold_backup_root = " + cluster_name;
cmd = cmd + std::string("\" config-server-test-restore.ini");
system(cmd.c_str());
system("./run.sh start_onebox --config_path config-server-test-restore.ini");
Expand Down