1
0
Fork 0

improved error messages, generate empty data file for dump-data=false

This commit is contained in:
Frank Celler 2019-01-30 12:30:10 +01:00
parent 603612f1d2
commit 66fd2425a4
1 changed files with 7 additions and 5 deletions

View File

@ -237,7 +237,8 @@ arangodb::Result dumpJsonObjects(arangodb::DumpFeature::JobData& jobData,
file.write(result->c_str(), result->length()); file.write(result->c_str(), result->length());
if (file.status().fail()) { if (file.status().fail()) {
return {TRI_ERROR_CANNOT_WRITE_FILE}; return {TRI_ERROR_CANNOT_WRITE_FILE, std::string("cannot write file '") + file.path() +
"': " + file.status().errorMessage()};
} }
jobData.stats.totalWritten += static_cast<uint64_t>(result->length()); jobData.stats.totalWritten += static_cast<uint64_t>(result->length());
@ -476,15 +477,16 @@ arangodb::Result processJob(arangodb::httpclient::SimpleHttpClient& client,
dumpData = jobData.maskings->shouldDumpData(jobData.name); dumpData = jobData.maskings->shouldDumpData(jobData.name);
} }
if (dumpData) { // always create the file so that arangorestore does not complain
// save the actual data auto file = jobData.directory.writableFile(jobData.name + "_" + hexString +
auto file = jobData.directory.writableFile(jobData.name + "_" + ".data.json",
hexString + ".data.json",
true); true);
if (!::fileOk(file.get())) { if (!::fileOk(file.get())) {
return ::fileError(file.get(), true); return ::fileError(file.get(), true);
} }
if (dumpData) {
// save the actual data
if (jobData.options.clusterMode) { if (jobData.options.clusterMode) {
result = ::handleCollectionCluster(client, jobData, *file); result = ::handleCollectionCluster(client, jobData, *file);
} else { } else {