1
0
Fork 0

version detection fixes

This commit is contained in:
Jan Steemann 2016-11-08 11:25:57 +01:00
parent 0ac4ec6ddf
commit 8b4e86b0d0
2 changed files with 11 additions and 4 deletions

View File

@ -1366,6 +1366,16 @@ LogicalCollection* MMFilesEngine::loadCollectionInfo(TRI_vocbase_t* vocbase, std
patch.openObject();
patch.add("isSystem", VPackValue(isSystemValue));
patch.add("path", VPackValue(path));
// auto-magic version detection to disambiguate collections from 3.0 and from 3.1
if (slice.hasKey("version") && slice.get("version").isNumber() &&
slice.get("version").getNumber<int>() == LogicalCollection::VERSION_30 &&
slice.hasKey("allowUserKeys") && slice.hasKey("replicationFactor") && slice.hasKey("numberOfShards")) {
// these attributes were added to parameter.json in 3.1. so this is a 3.1 collection already
// fix version number
patch.add("version", VPackValue(LogicalCollection::VERSION_31));
}
patch.close();
VPackBuilder b2 = VPackCollection::merge(slice, patch.slice(), false);
slice = b2.slice();

View File

@ -410,10 +410,7 @@ LogicalCollection::LogicalCollection(TRI_vocbase_t* vocbase,
"with the --database.auto-upgrade option.");
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_FAILED, errorMsg);
} else if (info.hasKey("indexes") && _version == VERSION_30) {
// already a 3.1 collection. upgrade the _version data
setVersion(VERSION_31);
}
}
if (_isVolatile && _waitForSync) {
// Illegal collection configuration