8000 Convert many uses of ClusterComm to Fuerte by dhly-etc · Pull Request #10154 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Convert many uses of ClusterComm to Fuerte #10154

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

Merged
merged 28 commits into from
Oct 10, 2019
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9aff2a4
Remove ClusterComm from v8-actions.cpp.
Sep 25, 2019
14d2cd0
Remove ClusterComm from GeneralServer.
Sep 25, 2019
0566cb2
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Sep 30, 2019
0f652d1
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Sep 30, 2019
ec0c1e4
Remove header.
Sep 30, 2019
52f50d9
Remove ClusterComm from Sharding.
Sep 30, 2019
0798b8b
Remove ClusterComm from RestHandler.
Sep 30, 2019
43c2c57
Remove ClusterComm from Graph.
Sep 30, 2019
f9dc2e7
Remove ClusterComm from IResearch.
Sep 30, 2019
3b38d4c
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Oct 1, 2019
8bc65ce
Fix replication trampolining and request forwarding in general.
Oct 2, 2019
c80e7ee
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Oct 2, 2019
e2acc9b
Remove ClusterComm from Transaction.
Oct 2, 2019
e765a25
Remove ClusterComm from Aql.
Oct 2, 2019
ab9b1ee
Remove ClusterComm from several files in Cluster.
Oct 2, 2019
9e1b0e4
Remove ClusterComm from SynchronizeShard.
Oct 2, 2019
ac6fafe
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Oct 2, 2019
4a9c798
Fix wrong status code.
Oct 3, 2019
0788605
Fix handling of server IDs.
Oct 3, 2019
9930d56
Revert logging change.
Oct 3, 2019
cbd8e8e
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Oct 3, 2019
e499939
Minor adjustment.
Oct 3, 2019
511b06f
Add waitForAny futures utility.
Oct 4, 2019
6e4522e
Address some review comments.
Oct 9, 2019
2b122f0
Address review comment.
Oct 9, 2019
1928630
Address more review comments.
Oct 9, 2019
c1179d9
Remove less-than-general method.
Oct 9, 2019
d7420a0
Merge branch 'devel' into feature/convert-clustercomm-use-to-network-…
Oct 9, 2019
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
Prev Previous commit
Next Next commit
Address review comment.
  • Loading branch information
8000
Dan Larkin-York committed Oct 9, 2019
commit 2b122f0958fce2278dea45bd19a01e808c9626b3
88 changes: 32 additions & 56 deletions arangod/Cluster/SynchronizeShard.cpp
8000 8000
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,11 @@ static arangodb::Result getReadLockId(network::ConnectionPool* pool,
options.timeout = network::Timeout(timeout);
auto res = network::sendRequest(pool, endpoint, fuerte::RestVerb::Get,
DB + database + REPL_HOLD_READ_LOCK,
VPackBuffer<uint8_t>(), network::Headers(), options);
res.wait();
VPackBuffer<uint8_t>(), network::Headers(), options)
.get();

if (res.hasValue() && res.get().ok() && res.get().response &&
res.get().response->statusCode() == fuerte::StatusOK) {
auto result = res.get();
auto const idSlice = result.response->slice();
if (res.ok() && res.response->statusCode() == fuerte::StatusOK) {
auto const idSlice = res.response->slice();
TRI_ASSERT(idSlice.isObject());
TRI_ASSERT(idSlice.hasKey(ID));
try {
Expand All @@ -167,11 +165,7 @@ static arangodb::Result getReadLockId(network::ConnectionPool* pool,
return arangodb::Result(TRI_ERROR_INTERNAL, error);
}
} else {
if (res.hasValue()) {
error.append(network::fuerteToArangoErrorMessage(res.get()));
} else {
error.append("no response");
}
error.append(network::fuerteToArangoErrorMessage(res));
return arangodb::Result(TRI_ERROR_INTERNAL, error);
}

Expand Down Expand Up @@ -282,7 +276,7 @@ static arangodb::Result addShardFollower(

std::string errorMessage(
"addShardFollower: could not add us to the leader's follower list. ");
if (res.response == nullptr || res.response->statusCode() != fuerte::StatusOK) {
if (res.fail() || res.response->statusCode() != fuerte::StatusOK) {
if (lockJobId != 0) {
errorMessage += network::fuerteToArangoErrorMessage(res);
LOG_TOPIC("22e0a", ERR, Logger::MAINTENANCE) << errorMessage;
Expand Down Expand Up @@ -326,12 +320,11 @@ static arangodb::Result cancelReadLockOnLeader(network::ConnectionPool* pool,
options.timeout = network::Timeout(timeout);
auto res = network::sendRequest(pool, endpoint, fuerte::RestVerb::Delete,
DB + database + REPL_HOLD_READ_LOCK,
std::move(*body.steal()), network::Headers(), options);
res.wait();
std::move(*body.steal()), network::Headers(), options)
.get();

if (res.hasValue() && res.get().ok() && res.get().response &&
res.get().response->statusCode() == fuerte::StatusNotFound) {
auto const slice = res.get().response->slice();
if (res.ok() && res.response && res.response->statusCode() == fuerte::StatusNotFound) {
auto const slice = res.response->slice();
if (slice.isObject()) {
VPackSlice s = slice.get(StaticStrings::ErrorNum);
if (s.isNumber()) {
Expand All @@ -344,10 +337,8 @@ static arangodb::Result cancelReadLockOnLeader(network::ConnectionPool* pool,
}
}

if (!res.hasValue() || res.get().fail() || !res.get().response ||
res.get().response->statusCode() != fuerte::StatusOK) {
auto errorMessage =
res.hasValue() ? network::fuerteToArangoErrorMessage(res.get()) : "no response";
if (res.fail() || res.response->statusCode() != fuerte::StatusOK) {
auto errorMessage = network::fuerteToArangoErrorMessage(res);
// rebuild body since we stole it earlier
VPackBuilder body;
{
Expand Down Expand Up @@ -382,32 +373,22 @@ static arangodb::Result cancelBarrier(network::ConnectionPool* pool,
auto res =
network::sendRequest(pool, endpoint, fuerte::RestVerb::Delete,
DB + database + REPL_BARRIER_API + std::to_string(barrierId),
VPackBuffer<uint8_t>(), network::Headers(), options);
res.wait();

if (!res.hasValue()) {
LOG_TOPIC("00aa2", ERR, Logger::MAINTENANCE)
<< "CancelBarrier: error: sendRequest did not return a value";
return arangodb::Result{TRI_ERROR_INTERNAL};
}

auto result = res.get();
if (result.ok()) {
auto response = result.response;
if (response == nullptr || (response->statusCode() != fuerte::StatusOK &&
response->statusCode() != fuerte::StatusNoContent)) {
std::string errorMessage =
response == nullptr
? "no response"
: ("got status " + std::to_string(response->statusCode()));
VPackBuffer<uint8_t>(), network::Headers(), options)
.get();

if (res.ok()) {
auto response = res.response;
if (response->statusCode() != fuerte::StatusOK &&
response->statusCode() != fuerte::StatusNoContent) {
std::string errorMessage = "got status " + std::to_string(response->statusCode());
LOG_TOPIC("f5733", ERR, Logger::MAINTENANCE)
<< "CancelBarrier: error '" << errorMessage << "'";
return arangodb::Result(TRI_ERROR_INTERNAL, errorMessage);
}
} else {
std::string error(
"CancelBarrier: failed to send message to leader : status ");
error += network::fuerteToArangoErrorMessage(result);
error += network::fuerteToArangoErrorMessage(res);
LOG_TOPIC("1c48a", ERR, Logger::MAINTENANCE) << error;
return arangodb::Result(TRI_ERROR_INTERNAL, error);
}
Expand Down Expand Up @@ -464,12 +445,11 @@ arangodb::Result SynchronizeShard::getReadLock(network::ConnectionPool* pool,

// Now check that we hold the read lock:
auto res = network::sendRequest(pool, endpoint, fuerte::RestVerb::Put, url,
*body, network::Headers(), options);
res.wait();
*body, network::Headers(), options)
.get();

if (res.hasValue() && res.get().ok() && res.get().response &&
res.get().response->statusCode() == fuerte::StatusOK) {
auto const slice = res.get().response->slice();
if (res.ok() && res.response->statusCode() == fuerte::StatusOK) {
auto const slice = res.response->slice();
TRI_ASSERT(slice.isObject());
VPackSlice lockHeld = slice.get("lockHeld");
if (lockHeld.isBoolean() && lockHeld.getBool()) {
Expand All @@ -478,9 +458,8 @@ arangodb::Result SynchronizeShard::getReadLock(network::ConnectionPool* pool,
LOG_TOPIC("b681f", DEBUG, Logger::MAINTENANCE)
<< "startReadLockOnLeader: Lock not yet acquired...";
} else {
if (res.hasValue() && res.get().ok() && res.get().response &&
res.get().response->statusCode() == fuerte::StatusNotFound) {
auto const slice = res.get().response->slice();
if (res.ok() && res.response->statusCode() == fuerte::StatusNotFound) {
auto const slice = res.response->slice();
if (slice.isObject()) {
VPackSlice s = slice.get(StaticStrings::ErrorNum);
if (s.isNumber()) {
Expand All @@ -494,8 +473,7 @@ arangodb::Result SynchronizeShard::getReadLock(network::ConnectionPool* pool,
// fall-through to other cases intentional here
}

std::string message =
res.hasValue() ? network::fuerteToArangoErrorMessage(res.get()) : "no response";
std::string message = network::fuerteToArangoErrorMessage(res);
LOG_TOPIC("a82bc", DEBUG, Logger::MAINTENANCE)
<< "startReadLockOnLeader: Do not see read lock yet:" << message;
}
Expand All @@ -507,12 +485,10 @@ arangodb::Result SynchronizeShard::getReadLock(network::ConnectionPool* pool,

try {
auto r = network::sendRequest(pool, endpoint, fuerte::RestVerb::Delete, url,
*body, network::Headers(), options);
r.wait();
if (!r.hasValue() || r.get().fail() || !r.get().response ||
r.get().response->statusCode() != fuerte::StatusOK) {
std::string addendum =
r.hasValue() ? network::fuerteToArangoErrorMessage(r.get()) : "no response";
*body, network::Headers(), options)
.get();
if (r.fail() || r.response->statusCode() != fuerte::StatusOK) {
std::string addendum = network::fuerteToArangoErrorMessage(r);
LOG_TOPIC("4f34d", ERR, Logger::MAINTENANCE)
<< "startReadLockOnLeader: cancelation error for shard - "
<< collection << ": " << addendum;
Expand Down
0