1
0
Fork 0

more debug infos

This commit is contained in:
jsteemann 2019-10-29 10:43:48 +01:00
parent 801b9048d7
commit 203333bfe4
4 changed files with 21 additions and 21 deletions

View File

@ -1162,10 +1162,10 @@ futures::Future<OperationResult> countOnCoordinator(transaction::Methods& trx,
/// @brief gets the selectivity estimates from DBservers
////////////////////////////////////////////////////////////////////////////////
int selectivityEstimatesOnCoordinator(ClusterFeature& feature, std::string const& dbname,
std::string const& collname,
std::unordered_map<std::string, double>& result,
TRI_voc_tick_t tid) {
Result selectivityEstimatesOnCoordinator(ClusterFeature& feature, std::string const& dbname,
std::string const& collname,
std::unordered_map<std::string, double>& result,
TRI_voc_tick_t tid) {
// Set a few variables needed for our work:
ClusterInfo& ci = feature.clusterInfo();
@ -1175,7 +1175,7 @@ int selectivityEstimatesOnCoordinator(ClusterFeature& feature, std::string const
std::shared_ptr<LogicalCollection> collinfo;
collinfo = ci.getCollectionNT(dbname, collname);
if (collinfo == nullptr) {
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
return {TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND};
}
std::shared_ptr<ShardMap> shards = collinfo->shardIds();
@ -1216,25 +1216,25 @@ int selectivityEstimatesOnCoordinator(ClusterFeature& feature, std::string const
network::Response const& r = f.get();
if (r.fail()) {
return network::fuerteToArangoErrorCode(r);
return {network::fuerteToArangoErrorCode(r), network::fuerteToArangoErrorMessage(r)};
}
VPackSlice answer = r.slice();
if (!answer.isObject()) {
return TRI_ERROR_INTERNAL;
return {TRI_ERROR_INTERNAL, "invalid response structure"};
}
if (answer.hasKey(StaticStrings::ErrorNum)) {
int errorNum = answer.get(StaticStrings::ErrorNum).getNumber<int>();
Result res = network::resultFromBody(answer, TRI_ERROR_NO_ERROR);
if (errorNum != TRI_ERROR_NO_ERROR) {
return errorNum;
if (res.fail()) {
return res;
}
}
answer = answer.get("indexes");
if (!answer.isObject()) {
return TRI_ERROR_INTERNAL;
return {TRI_ERROR_INTERNAL, "invalid response structure for 'indexes'"};
}
// add to the total
@ -1260,7 +1260,7 @@ int selectivityEstimatesOnCoordinator(ClusterFeature& feature, std::string const
result[p.first] = aggregateIndexes(p.second);
}
return TRI_ERROR_NO_ERROR;
return {};
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -106,10 +106,10 @@ futures::Future<OperationResult> countOnCoordinator(transaction::Methods& trx,
/// @brief gets the selectivity estimates from DBservers
////////////////////////////////////////////////////////////////////////////////
int selectivityEstimatesOnCoordinator(ClusterFeature&, std::string const& dbname,
std::string const& collname,
std::unordered_map<std::string, double>& result,
TRI_voc_tick_t tid = 0);
Result selectivityEstimatesOnCoordinator(ClusterFeature&, std::string const& dbname,
std::string const& collname,
std::unordered_map<std::string, double>& result,
TRI_voc_tick_t tid = 0);
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a document in a coordinator

View File

@ -77,11 +77,11 @@ IndexEstMap ClusterSelectivityEstimates::get(bool allowUpdating, TRI_voc_tid_t t
// must fetch estimates from coordinator
IndexEstMap estimates;
int res = selectivityEstimatesOnCoordinator(
Result res = selectivityEstimatesOnCoordinator(
_collection.vocbase().server().getFeature<ClusterFeature>(),
_collection.vocbase().name(), _collection.name(), estimates, tid);
if (res == TRI_ERROR_NO_ERROR) {
if (res.ok()) {
// store the updated estimates and return them
set(estimates);
return estimates;

View File

@ -116,9 +116,9 @@ arangodb::Result Indexes::getAll(LogicalCollection const* collection,
std::unordered_map<std::string, double> estimates;
auto& feature = collection->vocbase().server().getFeature<ClusterFeature>();
int rv = selectivityEstimatesOnCoordinator(feature, databaseName, cid, estimates);
if (rv != TRI_ERROR_NO_ERROR) {
return Result(rv, "could not retrieve estimates");
Result rv = selectivityEstimatesOnCoordinator(feature, databaseName, cid, estimates);
if (rv.fail()) {
return Result(rv.errorNumber(), "could not retrieve estimates" + rv.errorMessage());
}
// we will merge in the index estimates later