1
0
Fork 0

Propagate errors during index creation

This commit is contained in:
Andreas Streichardt 2017-01-13 13:21:41 +01:00
parent 19b22ea9bf
commit b0792f1de3
1 changed files with 8 additions and 7 deletions

View File

@ -1373,7 +1373,7 @@ function executePlanForCollections(plan) {
// found a shard we are responsible for // found a shard we are responsible for
localErrors[shard] = { error: false, errorNum: 0, localErrors[shard] = { error: false, errorNum: 0,
errorMessage: 'no error' }; errorMessage: 'no error', indexes: {} };
let error = localErrors[shard]; let error = localErrors[shard];
@ -1483,18 +1483,16 @@ function executePlanForCollections(plan) {
database, database,
shard, shard,
JSON.stringify(index)); JSON.stringify(index));
try { try {
arangodb.db._collection(shard).ensureIndex(index); arangodb.db._collection(shard).ensureIndex(index);
} catch (err5) { } catch (err5) {
if (error.indexes === undefined) { error.indexes[index.id] = {
error.indexes = []; id: index.id,
}
error.indexes.push({
error: true, error: true,
errorNum: err5.errorNum, errorNum: err5.errorNum,
errorMessage: err5.errorMessage errorMessage: err5.errorMessage
}); };
} }
} }
} }
@ -1636,6 +1634,9 @@ function updateCurrentForCollections(localErrors, current) {
payload.indexes[i].id = payload.indexes[i].id.slice(pos+1); payload.indexes[i].id = payload.indexes[i].id.slice(pos+1);
} }
} }
Object.keys(error.indexes).forEach(id => {
payload.indexes.push(error.indexes[id]);
});
if (error !== undefined && error.error) { if (error !== undefined && error.error) {
_.assign(payload, error); _.assign(payload, error);
} else { } else {