empiredan commented on code in PR #2302:
URL:
https://github.com/apache/incubator-pegasus/pull/2302#discussion_r2446640977
##########
src/zookeeper/lock_struct.cpp:
##########
@@ -637,20 +644,23 @@ void lock_struct::create_locknode()
}
if (op->_output.error != ZOK) {
- EXECUTE(
- std::bind(&lock_struct::after_create_locknode, _this,
op->_output.error, nullptr),
+ enqueue(
+ [_this, err = op->_output.error]() {
+ lock_struct::after_create_locknode(_this, err, nullptr);
+ },
_this);
return;
}
std::shared_ptr<std::string> path(new
std::string(op->_output.create_op._created_path));
- EXECUTE(std::bind(&lock_struct::after_create_locknode, _this, ZOK,
path), _this);
+ enqueue([_this, path]() { lock_struct::after_create_locknode(_this,
ZOK, path); }, _this);
};
zookeeper_session::zoo_input &input = op->_input;
- input._path = _lock_dir + "/" +
distributed_lock_service_zookeeper::LOCK_NODE_PREFIX;
+ input._path = std::make_shared<std::string>(
+ fmt::format("{}/{}", _lock_dir,
distributed_lock_service_zookeeper::LOCK_NODE_PREFIX));
input._value.assign(_myself._node_value.c_str(), 0,
_myself._node_value.length());
- input._flags = ZOO_EPHEMERAL | ZOO_SEQUENCE;
+ input._flags = ZOO_EPHEMERAL_SEQUENTIAL;
Review Comment:
For the following reasons, we must use `ZOO_EPHEMERAL_SEQUENTIAL` instead of
`ZOO_EPHEMERAL | ZOO_SEQUENCE`:
* We rely on ZooKeeper C client **3.9.4**, which defines
`ZOO_EPHEMERAL_SEQUENTIAL` as a replacement for `ZOO_EPHEMERAL | ZOO_SEQUENCE`.
* `ZOO_SEQUENCE` has already been **deprecated** — if it were to be used, it
should be replaced by `ZOO_PERSISTENT_SEQUENTIAL`.
* `ZOO_EPHEMERAL | ZOO_SEQUENCE` cannot pass the linter check;
**clang-tidy** reports the following warning:
`warning: use of a signed integer operand with a binary bitwise operator
[hicpp-signed-bitwise] input._flags = ZOO_EPHEMERAL | ZOO_SEQUENCE;`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]