mirror of https://gitee.com/bigwinds/arangodb
add windows suspend/resume hooks as @char101 sugested for others (#7833)
* add windows suspend/resume hooks * disable procdump
This commit is contained in:
parent
e05e88eebd
commit
457e14b970
|
@ -48,12 +48,13 @@ struct ApplierThread : public Thread {
|
|||
TRI_ASSERT(_syncer);
|
||||
}
|
||||
|
||||
~ApplierThread() {
|
||||
~ApplierThread() {
|
||||
shutdown();
|
||||
|
||||
{
|
||||
MUTEX_LOCKER(locker, _syncerMutex);
|
||||
_syncer.reset();
|
||||
}
|
||||
shutdown();
|
||||
}
|
||||
|
||||
void run() override {
|
||||
|
|
|
@ -93,6 +93,7 @@ function activeFailover (options) {
|
|||
let testCases = tu.scanTestPaths(testPaths.active_failover);
|
||||
options.activefailover = true;
|
||||
options.singles = 4;
|
||||
options.disableMonitor = true;
|
||||
return tu.performTests(options, testCases, 'client_resilience', tu.runInArangosh, {
|
||||
'server.authentication': 'true',
|
||||
'server.jwt-secret': 'haxxmann'
|
||||
|
|
|
@ -1430,6 +1430,15 @@ ExternalProcessStatus TRI_KillExternalProcess(ExternalId pid, int signal, bool i
|
|||
return TRI_CheckExternalProcess(pid, false);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef LONG (NTAPI *NtSuspendProcess)(IN HANDLE ProcessHandle);
|
||||
typedef LONG (NTAPI *NtResumeProcess)(IN HANDLE ProcessHandle);
|
||||
|
||||
NtSuspendProcess pfnNtSuspendProcess = (NtSuspendProcess)GetProcAddress(GetModuleHandle("ntdll"), "NtSuspendProcess");
|
||||
NtResumeProcess pfnNtResumeProcess = (NtResumeProcess)GetProcAddress(GetModuleHandle("ntdll"), "NtResumeProcess");
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief stops an external process, only on Unix
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1440,7 +1449,17 @@ bool TRI_SuspendExternalProcess(ExternalId pid) {
|
|||
#ifndef _WIN32
|
||||
return 0 == kill(pid._pid, SIGSTOP);
|
||||
#else
|
||||
return true;
|
||||
TRI_ERRORBUF;
|
||||
|
||||
HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid._pid);
|
||||
bool rc = pfnNtSuspendProcess(processHandle) == 0;
|
||||
if (!rc) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) <<
|
||||
"suspending of '" << pid._pid << "' failed, error: " << GetLastError() << " " << TRI_GET_ERRORBUF;
|
||||
}
|
||||
CloseHandle(processHandle);
|
||||
return rc;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1454,7 +1473,17 @@ bool TRI_ContinueExternalProcess(ExternalId pid) {
|
|||
#ifndef _WIN32
|
||||
return 0 == kill(pid._pid, SIGCONT);
|
||||
#else
|
||||
return true;
|
||||
TRI_ERRORBUF;
|
||||
|
||||
HANDLE processHandle = OpenProcess(PROCESS_SUSPEND_RESUME, FALSE, pid._pid);
|
||||
bool rc = processHandle != NULL && pfnNtResumeProcess(processHandle) == 0;
|
||||
if (!rc) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) <<
|
||||
"resuming of '" << pid._pid << "' failed, error: " << GetLastError() << " " << TRI_GET_ERRORBUF;
|
||||
}
|
||||
CloseHandle(processHandle);
|
||||
return rc;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -253,9 +253,14 @@ function ActiveFailoverSuite() {
|
|||
let currentLead = leaderInAgency();
|
||||
|
||||
return {
|
||||
setUpAll: function () {
|
||||
db._create(cname);
|
||||
},
|
||||
|
||||
setUp: function () {
|
||||
let col = db._create(cname);
|
||||
assertTrue(checkInSync(currentLead, servers));
|
||||
|
||||
let col = db._collection(cname);
|
||||
for (let i = 0; i < 10000; i++) {
|
||||
col.save({ attr: i});
|
||||
}
|
||||
|
@ -273,15 +278,20 @@ function ActiveFailoverSuite() {
|
|||
currentLead = leaderInAgency();
|
||||
print("connecting shell to leader ", currentLead);
|
||||
connectToServer(currentLead);
|
||||
if (db._collection(cname)) {
|
||||
db._drop(cname);
|
||||
}
|
||||
|
||||
assertTrue(checkInSync(currentLead, servers));
|
||||
|
||||
let endpoints = getClusterEndpoints();
|
||||
assertEqual(endpoints.length, servers.length);
|
||||
assertEqual(endpoints[0], currentLead);
|
||||
|
||||
db._collection(cname).truncate();
|
||||
},
|
||||
|
||||
tearDownAll: function () {
|
||||
if (db._collection(cname)) {
|
||||
db._drop(cname);
|
||||
}
|
||||
},
|
||||
|
||||
// Basic test if followers get in sync
|
||||
|
@ -435,6 +445,10 @@ function ActiveFailoverSuite() {
|
|||
|
||||
assertTrue(checkInSync(currentLead, servers));
|
||||
assertEqual(checkData(currentLead), 10000);
|
||||
/*if (checkData(currentLead) != 10000) {
|
||||
print("ERROR! DODEBUG")
|
||||
while(1){}
|
||||
}*/
|
||||
|
||||
print("Suspending followers, except original leader");
|
||||
suspended = instanceinfo.arangods.filter(arangod => arangod.role !== 'agent' &&
|
||||
|
|
|
@ -276,10 +276,18 @@ function ActiveFailoverSuite() {
|
|||
let currentLead = leaderInAgency();
|
||||
|
||||
return {
|
||||
setUpAll: function () {
|
||||
db._create(cname);
|
||||
},
|
||||
|
||||
setUp: function () {
|
||||
let col = db._create(cname);
|
||||
currentLead = leaderInAgency();
|
||||
print("connecting shell to leader ", currentLead);
|
||||
connectToServer(currentLead);
|
||||
|
||||
assertTrue(checkInSync(currentLead, servers));
|
||||
|
||||
let col = db._collection(cname);
|
||||
for (let i = 0; i < 10000; i++) {
|
||||
col.save({ attr: i});
|
||||
}
|
||||
|
@ -298,10 +306,10 @@ function ActiveFailoverSuite() {
|
|||
print("connecting shell to leader ", currentLead);
|
||||
connectToServer(currentLead);
|
||||
|
||||
setReadOnly(currentLead, false);
|
||||
/*setReadOnly(currentLead, false);
|
||||
if (db._collection(cname)) {
|
||||
db._drop(cname);
|
||||
}
|
||||
}*/
|
||||
|
||||
setReadOnly(currentLead, false);
|
||||
assertTrue(checkInSync(currentLead, servers));
|
||||
|
@ -309,8 +317,17 @@ function ActiveFailoverSuite() {
|
|||
let endpoints = getClusterEndpoints();
|
||||
assertEqual(endpoints.length, servers.length);
|
||||
assertEqual(endpoints[0], currentLead);
|
||||
|
||||
db._collection(cname).truncate();
|
||||
},
|
||||
|
||||
tearDownAll: function () {
|
||||
if (db._collection(cname)) {
|
||||
db._drop(cname);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
testReadFromLeader: function () {
|
||||
assertEqual(servers[0], currentLead);
|
||||
setReadOnly(currentLead, true);
|
||||
|
@ -345,15 +362,15 @@ function ActiveFailoverSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testReadFromFollower: function () {
|
||||
// impossible as of now
|
||||
},
|
||||
// impossible as of now
|
||||
//testReadFromFollower: function () {
|
||||
//X-Arango-Allow-Dirty-Read: true
|
||||
//},
|
||||
|
||||
testLeaderAfterFailover: function () {
|
||||
|
||||
assertTrue(checkInSync(currentLead, servers));
|
||||
assertEqual(checkData(currentLead), 10000);
|
||||
|
||||
|
||||
// set it read-only
|
||||
setReadOnly(currentLead, true);
|
||||
|
||||
|
@ -366,6 +383,7 @@ function ActiveFailoverSuite() {
|
|||
let oldLead = currentLead;
|
||||
// await failover and check that follower get in sync
|
||||
currentLead = checkForFailover(currentLead);
|
||||
return;
|
||||
assertTrue(currentLead !== oldLead);
|
||||
print("Failover to new leader : ", currentLead);
|
||||
|
||||
|
|
Loading…
Reference in New Issue