8000 fix dump tests (#13634) · arangodb/arangodb@1d94b53 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d94b53

Browse files
authored
fix dump tests (#13634)
1 parent f11ce90 commit 1d94b53

File tree

7 files changed

+27
-22
lines changed

7 files changed

+27
-22
lines changed

arangosh/Restore/RestoreFeature.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,11 +832,11 @@ arangodb::Result restoreData(arangodb::httpclient::SimpleHttpClient& httpClient,
832832
// note that we have to store the uncompressed offset here, because we
833833
// potentially have consumed more data than we have sent.
834834
datafileReadOffset += length;
835-
jobData.progressTracker.updateStatus(
835+
[[maybe_unused]] bool wasSynced = jobData.progressTracker.updateStatus(
836836
cname, arangodb::RestoreFeature::CollectionStatus{arangodb::RestoreFeature::RESTORING,
837837
datafileReadOffset});
838838
#ifdef ARANGODB_ENABLE_FAILURE_TESTS
839-
if (jobData.options.failOnUpdateContinueFile && length != 0) {
839+
if (wasSynced && jobData.options.failOnUpdateContinueFile && length != 0) {
840840
LOG_TOPIC("a87bf", WARN, Logger::RESTORE) << "triggered failure point at offset " << datafileReadOffset << "!";
841841
FATAL_ERROR_EXIT_CODE(38); // exit with exit code 38 to report to the test frame work that this was an intentional crash
842842
}
@@ -1765,6 +1765,8 @@ void RestoreFeature::start() {
17651765
<< basics::StringUtils::join(dbs, "', '") << "' from dump directory '" << _options.inputPath << "'...";
17661766
}
17671767

1768+
std::vector<std::string> filesToClean;
1769+
17681770
for (auto& db : databases) {
17691771
result.reset();
17701772

@@ -1837,6 +1839,8 @@ void RestoreFeature::start() {
18371839
LOG_TOPIC_IF("52b23", INFO, arangodb::Logger::RESTORE, _options.continueRestore) << "try to continue previous restore";
18381840
_progressTracker = std::make_unique<RestoreProgressTracker>(*_directory, !_options.continueRestore);
18391841

1842+
filesToClean.push_back(_progressTracker->filename());
1843+
18401844
// run the actual restore
18411845
try {
18421846
result = ::processInputDirectory(*httpClient, _clientTaskQueue, *this,
@@ -1857,13 +1861,15 @@ void RestoreFeature::start() {
18571861
if (result.fail()) {
18581862
break;
18591863
}
1860-
1861-
_progressTracker->cleanup();
18621864
}
18631865

18641866
if (result.fail()) {
18651867
LOG_TOPIC("cb69f", ERR, arangodb::Logger::RESTORE) << result.errorMessage();
18661868
_exitCode = EXIT_FAILURE;
1869+
} else {
1870+
for (auto const& fn : filesToClean) {
1871+
[[maybe_unused]] auto result = basics::FileUtils::remove(fn);
1872+
}
18671873
}
18681874

18691875
if (_options.progress) {

arangosh/Utils/ProgressTracker.h

-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ struct ProgressTracker {
3838
ProgressTracker& operator=(ProgressTracker&&) noexcept = delete;
3939

4040
T getStatus(std::string const& collectionName);
41-
void updateStatus(std::string const& collectionName, T const& status);
42-
void cleanup();
41+
/// @brief returns true if the progress was synced to disc
42+
bool updateStatus(std::string const& collectionName, T const& status);
43+
std::string filename() const;
4344

4445
ManagedDirectory& directory;
4546
std::shared_mutex _collectionStatesMutex;
@@ -49,14 +50,14 @@ struct ProgressTracker {
4950
};
5051

5152
template <typename T>
52-
void ProgressTracker<T>::updateStatus(std::string const& collectionName,
53+
bool ProgressTracker<T>::updateStatus(std::string const& collectionName,
5354
T const& status) {
5455
{
5556
std::unique_lock guard(_collectionStatesMutex);
5657
_collectionStates[collectionName] = status;
5758

5859
if (_writeQueued) {
59-
return;
60+
return false;
6061
}
6162

6263
_writeQueued = true;
@@ -81,6 +82,7 @@ void ProgressTracker<T>::updateStatus(std::string const& collectionName,
8182
arangodb::basics::VelocyPackHelper::velocyPackToFile(directory.pathToFile("continue.json"),
8283
VPackSlice(buffer.data()), true);
8384
}
85+
return true;
8486
}
8587

8688
template <typename T>
@@ -110,11 +112,8 @@ ProgressTracker<T>::ProgressTracker(ManagedDirectory& directory, bool ignoreExis
110112
}
111113

112114
template <typename T>
113-
void ProgressTracker<T>::cleanup() {
114-
// remove continue.json file, e.g. when the restore completed successfully
115-
std::unique_lock guard(_writeFileMutex);
116-
117-
[[maybe_unused]] auto result = basics::FileUtils::remove(directory.pathToFile("continue.json"));
115+
std::string ProgressTracker<T>::filename() const {
116+
return directory.pathToFile("continue.json");
118117
}
119118

120119
}

js/client/modules/@arangodb/testsuites/dump.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ const encryptionKey = '01234567890123456789012345678901';
6464
const encryptionKeySha256 = "861009ec4d599fab1f40abc76e6f89880cff5833c79c548c99f9045f191cd90b";
6565

6666
let timeoutFactor = 1;
67-
if (global.ARANGODB_CLIENT_VERSION(true).asan ||
68-
global.ARANGODB_CLIENT_VERSION(true).tsan ||
67+
if (global.ARANGODB_CLIENT_VERSION(true).asan === 'true' ||
68+
global.ARANGODB_CLIENT_VERSION(true).tsan === 'true' ||
6969
process.env.hasOwnProperty('GCOV_PREFIX')) {
7070
timeoutFactor = 8;
7171
}

js/client/modules/@arangodb/testutils/test-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ function filterTestcaseByOptions (testname, options, whichFilter) {
566566
return false;
567567
}
568568

569-
if ((testname.indexOf('-noasan') !== -1) && global.ARANGODB_CLIENT_VERSION(true).asan) {
569+
if ((testname.indexOf('-noasan') !== -1) && global.ARANGODB_CLIENT_VERSION(true).asan === 'true') {
570570
whichFilter.filter = 'skip when built with asan';
571571
return false;
572572
}

js/client/modules/@arangodb/testutils/testing.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ const optionsDefaults = {
213213
'onlyGrey': false,
214214
'oneTestTimeout': 15 * 60,
215215
'isAsan': (
216-
global.ARANGODB_CLIENT_VERSION(true).asan ||
217-
global.ARANGODB_CLIENT_VERSION(true).tsan),
216+
global.ARANGODB_CLIENT_VERSION(true).asan === 'true' ||
217+
global.ARANGODB_CLIENT_VERSION(true).tsan === 'true'),
218218
'skipTimeCritical': false,
219219
'storageEngine': 'rocksdb',
220220
'test': undefined,

tests/js/client/communication/test-kill.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ let pu = require('@arangodb/testutils/process-utils');
3131
let db = arangodb.db;
3232

3333
let timeout = 60;
34-
if (global.ARANGODB_CLIENT_VERSION(true).asan ||
35-
global.ARANGODB_CLIENT_VERSION(true).tsan ||
34+
if (global.ARANGODB_CLIENT_VERSION(true).asan === 'true' ||
35+
global.ARANGODB_CLIENT_VERSION(true).tsan === 'true' ||
3636
process.env.hasOwnProperty('GCOV_PREFIX')) {
3737
timeout *= 10;
3838
}

tests/js/client/shell/shell-deadlock-trx-hotbackup-cluster.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function trxWriteHotbackupDeadlock () {
104104
let jobid = res.headers["x-arango-async-id"];
105105

106106
let timeout = 60;
107-
if (global.ARANGODB_CLIENT_VERSION(true).asan ||
108-
global.ARANGODB_CLIENT_VERSION(true).tsan ||
107+
if (global.ARANGODB_CLIENT_VERSION(true).asan === 'true' ||
108+
global.ARANGODB_CLIENT_VERSION(true).tsan === 'true' ||
109109
process.env.hasOwnProperty('GCOV_PREFIX')) {
110110
timeout *= 10;
111111
}

0 commit comments

Comments
 (0)
0