8000 properly check wether the replication follower instance is still aliv… · mnemosdev/arangodb@55a45f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 55a45f1

Browse files
dothebartjsteemann
authored andcommitted
properly check wether the replication follower instance is still alive (arangodb#6938)
1 parent 46ee6d9 commit 55a45f1

File tree

2 files changed

+79
-14
lines changed

2 files changed

+79
-14
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ function performTests (options, testList, testname, runFn, serverOptions, startS
101101

102102
let env = {};
103103
let customInstanceInfos = {};
104+
let healthCheck = function () {return true;};
105+
106+
if (startStopHandlers !== undefined && startStopHandlers.hasOwnProperty('healthCheck')) {
107+
healthCheck = startStopHandlers.healthCheck;
108+
}
104109

105110
if (startStopHandlers !== undefined && startStopHandlers.hasOwnProperty('preStart')) {
106111
customInstanceInfos['preStart'] = startStopHandlers.preStart(options,
@@ -217,7 +222,8 @@ function performTests (options, testList, testname, runFn, serverOptions, startS
217222
}
218223
}
219224

220-
if (pu.arangod.check.instanceAlive(instanceInfo, options)) {
225+
if (pu.arangod.check.instanceAlive(instanceInfo, options) &&
226+
healthCheck(options, serverOptions, instanceInfo, customInstanceInfos, startStopHandlers)) {
221227
continueTesting = true;
222228

223229
// Check whether some collections were left behind, and if mark test as failed.

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

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function replicationFuzz (options) {
8989
if (state) {
9090
message = 'failed to start slave instance!';
9191
}
92-
92+
slave['isSlaveInstance'] = true;
9393
return {
9494
instanceInfo: slave,
9595
message: message,
@@ -100,13 +100,22 @@ function replicationFuzz (options) {
100100
};
101101
},
102102

103+
healthCheck: function (options,
104+
serverOptions,
105+
instanceInfo,
106+
customInstanceInfos,
107+
startStopHandlers) {
108+
return pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options);
109+
},
110+
103111
preStop: function (options,
104112
serverOptions,
105113
instanceInfo,
106114
customInstanceInfos,
107115
startStopHandlers) {
108-
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
109-
116+
if (pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options)) {
117+
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
118+
}
110119
return {};
111120
},
112121

@@ -150,6 +159,7 @@ function replicationRandom (options) {
150159
message = 'failed to start slave instance!';
151160
}
152161

162+
slave['isSlaveInstance'] = true;
153163
return {
154164
instanceInfo: slave,
155165
message: message,
@@ -160,13 +170,22 @@ function replicationRandom (options) {
160170
};
161171
},
162172

173+
healthCheck: function (options,
174+
serverOptions,
175+
instanceInfo,
176+
customInstanceInfos,
177+
startStopHandlers) {
178+
return pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options);
179+
},
180+
163181
preStop: function (options,
164182
serverOptions,
165183
instanceInfo,
166184
customInstanceInfos,
167185
startStopHandlers) {
168-
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
169-
186+
if (pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options)) {
187+
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
188+
}
170189
return {};
171190
},
172191

@@ -210,6 +229,7 @@ function replicationAql (options) {
210229
message = 'failed to start slave instance!';
211230
}
212231

232+
slave['isSlaveInstance'] = true;
213233
return {
214234
instanceInfo: slave,
215235
message: message,
@@ -220,13 +240,22 @@ function replicationAql (options) {
220240
};
221241
},
222242

243+
healthCheck: function (options,
244+
serverOptions,
245+
instanceInfo,
246+
customInstanceInfos,
247+
startStopHandlers) {
248+
return pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options);
249+
},
250+
223251
preStop: function (options,
224252
serverOptions,
225253
instanceInfo,
226254
customInstanceInfos,
227255
startStopHandlers) {
228-
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
229-
256+
if (pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options)) {
257+
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
258+
}
230259
return {};
231260
},
232261

@@ -273,6 +302,7 @@ function replicationOngoing (options) {
273302
message = 'failed to start slave instance!';
274303
}
275304

305+
slave['isSlaveInstance'] = true;
276306
return {
277307
instanceInfo: slave,
278308
message: message,
@@ -283,13 +313,22 @@ function replicationOngoing (options) {
283313
};
284314
},
285315

316+
healthCheck: function (options,
317+
serverOptions,
318+
instanceInfo,
319+
customInstanceInfos,
320+
startStopHandlers) {
321+
return pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options);
322+
},
323+
286324
preStop: function (options,
287325
serverOptions,
288326
instanceInfo,
289327
customInstanceInfos,
290328
startStopHandlers) {
291-
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
292-
329+
if (pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options)) {
330+
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
331+
}
293332
return {};
294333
},
295334

@@ -350,10 +389,10 @@ function replicationStatic (options) {
350389
message = 'failed to setup slave connection' + res.message;
351390
pu.shutdownInstance(slave, options);
352391
}
392+
slave['isSlaveInstance'] = true;
353393
} else {
354394
message = 'failed to start slave instance!';
355395
}
356-
357396
return {
358397
instanceInfo: slave,
359398
message: message,
@@ -364,12 +403,22 @@ function replicationStatic (options) {
364403
};
365404
},
366405

406+
healthCheck: function (options,
407+
serverOptions,
408+
instanceInfo,
409+
customInstanceInfos,
410+
startStopHandlers) {
411+
return pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options);
412+
},
413+
367414
preStop: function (options,
368415
serverOptions,
369416
instanceInfo,
370417
customInstanceInfos,
371418
startStopHandlers) {
372-
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
419+
if (pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options)) {
420+
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
421+
}
373422
return {};
374423
},
375424

@@ -435,6 +484,7 @@ function replicationSync (options) {
435484
message = 'failed to setup slave connection' + res.message;
436485
pu.shutdownInstance(slave, options);
437486
}
487+
slave['isSlaveInstance'] = true;
438488
} else {
439489
message = 'failed to start slave instance!';
440490
}
@@ -449,13 +499,22 @@ function replicationSync (options) {
449499
};
450500
},
451501

502+
healthCheck: function (options,
503+
serverOptions,
504+
instanceInfo,
505+
customInstanceInfos,
506+
startStopHandlers) {
507+
return pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options);
508+
},
509+
452510
preStop: function (options,
453511
serverOptions,
454512
instanceInfo,
455513
customInstanceInfos,
456514
startStopHandlers) {
457-
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
458-
515+
if (pu.arangod.check.instanceAlive(customInstanceInfos.postStart.instanceInfo, options)) {
516+
pu.shutdownInstance(customInstanceInfos.postStart.instanceInfo, options);
517+
}
459518
return {};
460519
},
461520

0 commit comments

Comments
 (0)
0