-
Notifications
You must be signed in to change notification settings - Fork 59
split: add app_partition_split request and unit test #111
Conversation
# 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 { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 meta storage, 不要用 remote storage
There was a problem hiding this comment.
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,之后重构的时候再改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有写 zk 的优先级都应该是 high, 不需要在重试的时候改
include/dsn/cpp/serialization_helper/dsn.layer2_types.h |
} else if (ec == ERR_TIMEOUT) { | ||
dwarn_f("remote storage is not available now, please try it later"); | ||
tasking::enqueue(LPC_META_STATE_HIGH, | ||
nullptr, |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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);
刚刚交了一个新的commit,把code format都加上了 @neverchanje |
哪个提交? 现在 diff 还是没 format |
commit 8a62162 |
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