Skip to content

Commit 1afc826

Browse files
committed
Merge branch 'devel' of github.com:arangodb/arangodb into feature/supervised-aql-value
2 parents 191beca + 5c7d89a commit 1afc826

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ function hotBackup_load_backend (options, which, args) {
211211
!helper.createHotBackup() ||
212212
!helper.stopStressArangosh() ||
213213
!helper.restoreHotBackup() ||
214+
!helper.IM.waitForAllShardsInSync() ||
214215
!retryWaitRestore(args.postRestoreFn, args.args)
215216
//!helper.runRtaCheckData()
216217
) {

js/client/modules/@arangodb/testutils/instance-manager.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,57 @@ class instanceManager {
11671167
});
11681168
}
11691169

1170+
waitForAllShardsInSync() {
1171+
if (!this.isCluster) {
1172+
return true;
1173+
}
1174+
let count = 0;
1175+
let collections = [];
1176+
let dbs = db._databases();
1177+
while (count < 500) {
1178+
let dbsOk = 0;
1179+
dbs.forEach(oneDb => {
1180+
db._useDatabase(oneDb);
1181+
collections = [];
1182+
let found = 0;
1183+
let shardDist = arango.GET("/_admin/cluster/shardDistribution");
1184+
if (shardDist.code !== 200 || typeof shardDist.results !== "object") {
1185+
++count;
1186+
return;
1187+
}
1188+
let cols = Object.keys(shardDist.results);
1189+
cols.forEach((c) => {
1190+
let col = shardDist.results[c];
1191+
let shards = Object.keys(col.Plan);
1192+
shards.forEach((s) => {
1193+
try {
1194+
if (col.Current.hasOwnProperty(s) && (col.Plan[s].leader !== col.Current[s].leader)) {
1195+
++found;
1196+
collections.push([c, s]);
1197+
}
1198+
} catch (ex) {
1199+
print(`${Date()} 015: ${s}`);
1200+
print(`${Date()} 015: ${JSON.stringify(col)}`);
1201+
print(`${Date()} 015: ${ex}`);
1202+
}
1203+
});
1204+
});
1205+
if (found > 0) {
1206+
print(`${Date()} 015: ${found} found - Waiting - ${JSON.stringify(collections)}`);
1207+
internal.sleep(1);
1208+
count += 1;
1209+
} else {
1210+
dbsOk += 1;
1211+
return;
1212+
}
1213+
});
1214+
if (dbs.length === dbsOk) {
1215+
break;
1216+
}
1217+
}
1218+
return count < 500;
1219+
}
1220+
11701221
stopServerWaitFailed(urlIDOrShortName) {
11711222
this.arangods.forEach(arangod => {
11721223
if (!arangod.matches(instanceRole.dbServer, urlIDOrShortName)) {

0 commit comments

Comments
 (0)