Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

split: add app_partition_split request and unit test #111

Closed
wants to merge 31 commits into from

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented Jun 21, 2018

app_partition_split is the request which client send to meta server, meta server will validate request and change partition count on remote storage.

refer to #69

neverchanje and others added 30 commits May 11, 2018 23:08
# Conflicts:
#	include/dsn/dist/replication/replica_test_utils.h
#	src/dist/replication/lib/replica.h
#	src/dist/replication/meta_server/meta_state_service_utils.cpp
#	src/dist/replication/meta_server/meta_state_service_utils_impl.h
#	src/dist/replication/meta_server/split/meta_split_service.cpp
#	src/dist/replication/test/meta_test/unit_test/meta_state_service_utils_test.cpp
# Conflicts:
#	include/dsn/dist/replication/replication.types.h
#	include/dsn/dist/replication/replication_types.h
#	src/dist/replication/lib/replica.h
#	src/dist/replication/replication.thrift
# Conflicts:
#	include/dsn/dist/replication/replication.types.h
#	include/dsn/dist/replication/replication_types.h
#	src/dist/replication/lib/replica.h
#	src/dist/replication/replication.thrift
# Conflicts:
#	include/dsn/cpp/pipeline.h
#	include/dsn/dist/replication/replication.codes.h
#	include/dsn/dist/replication/replication_types.h
#	src/dist/replication/client_lib/replication_types.cpp
#	src/dist/replication/lib/replica.h
#	src/dist/replication/lib/replica_stub.cpp
#	src/dist/replication/meta_server/meta_state_service_utils.cpp
#	src/dist/replication/meta_server/meta_state_service_utils_impl.h
#	src/dist/replication/test/meta_test/unit_test/meta_state_service_utils_test.cpp
# Conflicts:
#	include/dsn/cpp/pipeline.h
#	include/dsn/dist/replication/replication.codes.h
#	include/dsn/dist/replication/replication_types.h
#	src/dist/replication/client_lib/replication_types.cpp
#	src/dist/replication/lib/replica.h
#	src/dist/replication/lib/replica_stub.cpp
#	src/dist/replication/meta_server/meta_state_service_utils.cpp
#	src/dist/replication/meta_server/meta_state_service_utils_impl.h
#	src/dist/replication/test/meta_test/unit_test/meta_state_service_utils_test.cpp
@@ -3,84 +3,89 @@
#include <dsn/service_api_cpp.h>
#include <dsn/cpp/serialization.h>

namespace dsn {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codeformat

}

meta_split_service::meta_split_service(meta_service* meta_srv){
this->_meta_svc = meta_srv;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要 this->

copy.partition_count *= 2;
blob value = dsn::json::json_forwarder<app_info>::encode(copy);

_meta_svc->get_remote_storage()->set_data(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 meta storage, 不要用 remote storage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重试的时候优先级会变高,task_code会变成LPC_META_STATE_HIGH,这次功能开发先这样写,我会把它记作TODO,之后重构的时候再改

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所有写 zk 的优先级都应该是 high, 不需要在重试的时候改

@neverchanje
Copy link
Contributor

include/dsn/cpp/serialization_helper/dsn.layer2_types.h
include/dsn/dist/replication/replication_types.h
src/dsn.layer2_types.cpp
src/dist/replication/client_lib/replication_types.cpp
这些文件都需要 format

} else if (ec == ERR_TIMEOUT) {
dwarn_f("remote storage is not available now, please try it later");
tasking::enqueue(LPC_META_STATE_HIGH,
nullptr,
Copy link
Contributor

@neverchanje neverchanje Jun 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remote storage 是用来省代码来让逻辑更清晰的. 你这里的 tracker 就是传 null, 是不安全的.
remote storage 帮你省掉 timeout 重试, error abort 的代码, 你应该去尝试使用一下.

std::move(app),
std::move(rpc)),
0,
std::chrono::seconds(1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

推荐使用 1_s = std::chrono::seconds(1)), see https://github.com/XiaoMi/rdsn/blob/master/include/dsn/utility/chrono_literals.h

比如 tasking::enqueue(..., 1_s);

@hycdong
Copy link
Contributor Author

hycdong commented Jun 22, 2018

刚刚交了一个新的commit,把code format都加上了 @neverchanje

@neverchanje
Copy link
Contributor

哪个提交? 现在 diff 还是没 format

@hycdong
Copy link
Contributor Author

hycdong commented Jun 25, 2018

commit 8a62162

@neverchanje neverchanje added type/enhancement Indicates new feature requests component/split and removed new feature type/enhancement Indicates new feature requests labels Sep 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants