1
0
Fork 0

changed the order of index creation during restore for _users collection

This commit is contained in:
hkernbach 2019-11-26 11:44:11 +01:00
parent c903bc1e3a
commit e0ffabf490
1 changed files with 29 additions and 10 deletions

View File

@ -1060,6 +1060,23 @@ arangodb::Result processInputDirectory(
arangodb::Result processJob(arangodb::httpclient::SimpleHttpClient& httpClient, arangodb::Result processJob(arangodb::httpclient::SimpleHttpClient& httpClient,
arangodb::RestoreFeature::JobData& jobData) { arangodb::RestoreFeature::JobData& jobData) {
arangodb::Result result; arangodb::Result result;
VPackSlice const parameters = jobData.collection.get("parameters");
std::string const cname =
arangodb::basics::VelocyPackHelper::getStringValue(parameters, "name", "");
if (cname == "_users") {
// special case: never restore data in the _users collection first as it could
// potentially change user permissions. In that case index creation will fail.
result = ::restoreIndexes(httpClient, jobData);
if (result.fail()) {
return result;
}
result = ::restoreData(httpClient, jobData);
if (result.fail()) {
return result;
}
} else {
if (jobData.options.indexesFirst && jobData.options.importStructure) { if (jobData.options.indexesFirst && jobData.options.importStructure) {
// restore indexes first if we are using rocksdb // restore indexes first if we are using rocksdb
result = ::restoreIndexes(httpClient, jobData); result = ::restoreIndexes(httpClient, jobData);
@ -1080,6 +1097,8 @@ arangodb::Result processJob(arangodb::httpclient::SimpleHttpClient& httpClient,
return result; return result;
} }
} }
}
++jobData.stats.restoredCollections; ++jobData.stats.restoredCollections;