From 574d9c2d26fe0b37a60e3fe36d42802e41f8baa6 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 3 Dec 2018 16:18:27 +0100 Subject: [PATCH] dont fail when restoring a cluster dump into a single server (#7596) --- arangod/Indexes/IndexFactory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arangod/Indexes/IndexFactory.cpp b/arangod/Indexes/IndexFactory.cpp index ae2f789b3e..c0723b2851 100644 --- a/arangod/Indexes/IndexFactory.cpp +++ b/arangod/Indexes/IndexFactory.cpp @@ -213,8 +213,13 @@ TRI_idx_iid_t IndexFactory::validateSlice(arangodb::velocypack::Slice info, if (iid == 0 && !isClusterConstructor) { // Restore is not allowed to generate an id - TRI_ASSERT(generateKey); - iid = arangodb::Index::generateId(); + VPackSlice type = info.get("type"); + // dont generate ids for indexes of type "primary" + // id 0 is expected for primary indexes + if (!type.isString() || !type.isEqualString("primary")) { + TRI_ASSERT(generateKey); + iid = arangodb::Index::generateId(); + } } return iid;