1
0
Fork 0
This commit is contained in:
Jan Steemann 2014-07-03 22:50:22 +02:00
parent f939b079c4
commit 04ed18be47
4 changed files with 159 additions and 9 deletions

View File

@ -207,6 +207,8 @@ unittests-recovery:
@echo "================================================================================"
@echo
$(MAKE) execute-recovery-test PID=$(PID) RECOVERY_SCRIPT="resume-recovery-multi-flush"
$(MAKE) execute-recovery-test PID=$(PID) RECOVERY_SCRIPT="resume-recovery-simple"
$(MAKE) execute-recovery-test PID=$(PID) RECOVERY_SCRIPT="resume-recovery-all"
$(MAKE) execute-recovery-test PID=$(PID) RECOVERY_SCRIPT="resume-recovery"
$(MAKE) execute-recovery-test PID=$(PID) RECOVERY_SCRIPT="foxx-directories"

View File

@ -415,7 +415,10 @@ bool LogfileManager::open () {
// set all logfiles to sealed status so they can be collected
// we don't care about the previous status here
logfile->setStatus(Logfile::StatusType::SEAL_REQUESTED);
logfile->forceStatus(Logfile::StatusType::SEALED);
if (logfile->id() > _lastSealedId) {
_lastSealedId = logfile->id();
}
}
}
}
@ -469,15 +472,7 @@ bool LogfileManager::open () {
}
TRI_ASSERT(_collectorThread != nullptr);
/*
if (! _recoverState->hasRunningRemoteTransactions()) {
// wait for the collector to copy over everything
// we can only do this if there are no pending remote transactions
LOG_TRACE("waiting for collector to catch up");
waitForCollector(_lastOpenedId);
}
*/
// finished recovery
_inRecovery = false;
@ -1655,6 +1650,20 @@ int LogfileManager::inspectLogfiles () {
WRITE_LOCKER(_logfilesLock);
#ifdef TRI_ENABLE_MAINTAINER_MODE
// print an inventory
for (auto it = _logfiles.begin(); it != _logfiles.end(); ++it) {
Logfile* logfile = (*it).second;
if (logfile != nullptr) {
LOG_DEBUG("logfile %llu, filename '%s', status %s",
(unsigned long long) logfile->id(),
logfile->filename().c_str(),
logfile->statusText().c_str());
}
}
#endif
for (auto it = _logfiles.begin(); it != _logfiles.end(); ) {
Logfile::IdType const id = (*it).first;
std::string const filename = logfileName(id);

View File

@ -0,0 +1,70 @@
var db = require("org/arangodb").db;
var internal = require("internal");
var jsunity = require("jsunity");
function runSetup () {
internal.debugClearFailAt();
db._drop("UnitTestsRecovery");
var c = db._create("UnitTestsRecovery"), i;
for (i = 0; i < 10; ++i) {
var doc = { _key: "test" + i };
doc["value" + i] = i;
c.save(doc);
internal.wal.flush(true, true);
}
internal.debugSegfault("crashing server");
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite
////////////////////////////////////////////////////////////////////////////////
function recoverySuite () {
jsunity.jsUnity.attachAssertions();
return {
setUp: function () {
},
tearDown: function () {
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test whether we can restore the trx data
////////////////////////////////////////////////////////////////////////////////
testResumeRecoveryMultiFlush : function () {
var c = db._collection("UnitTestsRecovery"), doc, i;
assertEqual(10, c.count());
for (i = 0; i < 10; ++i) {
doc = c.document("test" + i);
assertTrue(doc.hasOwnProperty("value" + i));
assertEqual(i, doc["value" + i]);
}
}
};
}
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suite
////////////////////////////////////////////////////////////////////////////////
function main (argv) {
if (argv[1] === "setup") {
runSetup();
return 0;
}
else {
jsunity.run(recoverySuite);
return jsunity.done() ? 0 : 1;
}
}

View File

@ -0,0 +1,69 @@
var db = require("org/arangodb").db;
var internal = require("internal");
var jsunity = require("jsunity");
function runSetup () {
internal.debugClearFailAt();
db._drop("UnitTestsRecovery");
var c = db._create("UnitTestsRecovery");
c.ensureHashIndex("foo", "bar");
c.save({ _key: "test", "foo": 1, "bar": 2 }, true);
internal.wal.flush(true, true);
internal.wal.flush(true, false);
internal.wait(2);
internal.debugSegfault("crashing server");
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite
////////////////////////////////////////////////////////////////////////////////
function recoverySuite () {
jsunity.jsUnity.attachAssertions();
return {
setUp: function () {
},
tearDown: function () {
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test whether we can restore the trx data
////////////////////////////////////////////////////////////////////////////////
testResumeRecoverySimple : function () {
var c = db._collection("UnitTestsRecovery"), doc;
var idx = c.getIndexes()[1];
assertEqual(1, c.count());
doc = c.document("test");
assertEqual(1, doc.foo);
assertEqual(2, doc.bar);
assertEqual(1, c.byExampleHash(idx.id, { foo: 1, bar: 2 }).toArray().length);
}
};
}
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suite
////////////////////////////////////////////////////////////////////////////////
function main (argv) {
if (argv[1] === "setup") {
runSetup();
return 0;
}
else {
jsunity.run(recoverySuite);
return jsunity.done() ? 0 : 1;
}
}