1
0
Fork 0

Bug fix/display sync progress (#6691)

This commit is contained in:
Jan 2018-10-02 20:00:04 +02:00 committed by GitHub
parent 5570086f07
commit dea8a774df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 16 deletions

View File

@ -21,6 +21,7 @@
////////////////////////////////////////////////////////////////////////////////
#include "ShardDistributionReporter.h"
#include "Basics/StringUtils.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterInfo.h"
#include "VocBase/LogicalCollection.h"
@ -317,7 +318,8 @@ void ShardDistributionReporter::helperDistributionForDatabase(
} else {
entry.followers = curServers;
if (timeleft > 0.0) {
std::string path = "/_api/collection/" + s.first + "/count";
std::string path = "/_db/" + basics::StringUtils::urlEncode(dbName) +
"/_api/collection/" + basics::StringUtils::urlEncode(s.first) + "/count";
auto body = std::make_shared<std::string const>();
{

View File

@ -300,20 +300,20 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
response.answer_code = rest::ResponseCode::OK;
response.status = CL_COMM_RECEIVED;
// '/_api/collection/' + shard.shard + '/count'
// '/_db/UnitTestDB/_api/collection/' + shard.shard + '/count'
if (destination == "server:" + dbserver1) {
// off-sync follows s2,s3
if (path == "/_api/collection/" + s2 + "/count") {
if (path == "/_db/UnitTestDB/_api/collection/" + s2 + "/count") {
response.result = std::shared_ptr<SimpleHttpResult>(
&httpdb1s2Count, [](SimpleHttpResult*) {});
} else {
REQUIRE(path == "/_api/collection/" + s3 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s3 + "/count");
response.result = std::shared_ptr<SimpleHttpResult>(
&httpdb1s3Count, [](SimpleHttpResult*) {});
}
} else if (destination == "server:" + dbserver2) {
// Leads s2
REQUIRE(path == "/_api/collection/" + s2 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s2 + "/count");
response.result = std::shared_ptr<SimpleHttpResult>(
&httpdb2s2Count, [](SimpleHttpResult*) {});
leaderS2Response = response;
@ -323,11 +323,11 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
} else if (destination == "server:" + dbserver3) {
// Leads s3
// off-sync follows s2
if (path == "/_api/collection/" + s2 + "/count") {
if (path == "/_db/UnitTestDB/_api/collection/" + s2 + "/count") {
response.result = std::shared_ptr<SimpleHttpResult>(
&httpdb3s2Count, [](SimpleHttpResult*) {});
} else {
REQUIRE(path == "/_api/collection/" + s3 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s3 + "/count");
response.result = std::shared_ptr<SimpleHttpResult>(
&httpdb3s3Count, [](SimpleHttpResult*) {});
leaderS3Response = response;
@ -898,7 +898,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
@ -1001,7 +1001,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
@ -1115,7 +1115,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
coordId = coordTransactionID;
@ -1220,7 +1220,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
coordId = coordTransactionID;
@ -1335,7 +1335,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
coordId = coordTransactionID;
@ -1438,7 +1438,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
coordId = coordTransactionID;
@ -1543,7 +1543,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
coordId = coordTransactionID;
@ -1658,7 +1658,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();
coordId = coordTransactionID;
@ -1820,7 +1820,7 @@ SCENARIO("The shard distribution can be reported", "[cluster][shards]") {
std::shared_ptr<ClusterCommCallback> callback,
ClusterCommTimeout timeout, bool singleRequest,
ClusterCommTimeout initTimeout) -> OperationID {
REQUIRE(path == "/_api/collection/" + s1 + "/count");
REQUIRE(path == "/_db/UnitTestDB/_api/collection/" + s1 + "/count");
OperationID opId = TRI_NewTickServer();