1
0
Fork 0

replication ui requested changes (#5562)

This commit is contained in:
Heiko 2018-06-08 11:19:41 +02:00 committed by Jan
parent 9ec12a7470
commit fe0b88fb08
2 changed files with 17 additions and 4 deletions

View File

@ -1946,19 +1946,26 @@ void RestReplicationHandler::handleCommandApplierGetStateAll() {
if (_request->databaseName() != StaticStrings::SystemDatabase) {
generateError(rest::ResponseCode::FORBIDDEN, TRI_ERROR_FORBIDDEN,
"global inventory can only be fetched from within _system database");
return;
}
DatabaseFeature* databaseFeature = application_features::ApplicationServer::getFeature<DatabaseFeature>("Database");
VPackBuilder builder;
builder.openObject();
for (auto& name : databaseFeature->getDatabaseNames()) {
builder.add(name, VPackValue(VPackValueType::Object));
TRI_vocbase_t* vocbase = databaseFeature->lookupDatabase(name);
if (vocbase == nullptr) {
continue;
}
ReplicationApplier* applier = vocbase->replicationApplier();
if (applier == nullptr) {
return;
continue;
}
builder.add(name, VPackValue(VPackValueType::Object));
applier->toVelocyPack(builder);
builder.close();
}

View File

@ -615,13 +615,19 @@ static void StateApplierReplicationAll(v8::FunctionCallbackInfo<v8::Value> const
VPackBuilder builder;
builder.openObject();
for (auto& name : databaseFeature->getDatabaseNames()) {
builder.add(name, VPackValue(VPackValueType::Object));
TRI_vocbase_t* vocbase = databaseFeature->lookupDatabase(name);
if (vocbase == nullptr) {
continue;
}
ReplicationApplier* applier = vocbase->replicationApplier();
if (applier == nullptr) {
return;
continue;
}
builder.add(name, VPackValue(VPackValueType::Object));
applier->toVelocyPack(builder);
builder.close();
}