mirror of https://gitee.com/bigwinds/arangodb
fix _rev handling when creating collections
This commit is contained in:
parent
c086eaf3d8
commit
5324a6bbe8
|
@ -1086,7 +1086,7 @@ int MMFilesCollection::iterateMarkersOnLoad(arangodb::Transaction* trx) {
|
|||
<< openState._deletions << " deletion markers for collection '" << _logicalCollection->name() << "'";
|
||||
|
||||
if (_logicalCollection->version() <= LogicalCollection::VERSION_30 &&
|
||||
_lastRevision >= static_cast<TRI_voc_rid_t>(2016 - 1970) * 1000 * 60 * 60 * 24 * 365 &&
|
||||
_lastRevision >= static_cast<TRI_voc_rid_t>(2016ULL - 1970ULL) * 1000ULL * 60ULL * 60ULL * 24ULL * 365ULL &&
|
||||
application_features::ApplicationServer::server->getFeature<DatabaseFeature>("Database")->check30Revisions()) {
|
||||
// a collection from 3.0 or earlier with a _rev value that is higher than we can handle safely
|
||||
_logicalCollection->setRevisionError();
|
||||
|
|
|
@ -398,7 +398,7 @@ LogicalCollection::LogicalCollection(TRI_vocbase_t* vocbase,
|
|||
_lastCompactionStamp(0.0),
|
||||
_uncollectedLogfileEntries(0),
|
||||
_revisionError(false) {
|
||||
|
||||
|
||||
if (!IsAllowedName(info)) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_ILLEGAL_NAME);
|
||||
}
|
||||
|
@ -410,6 +410,9 @@ 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) {
|
||||
|
|
|
@ -134,6 +134,8 @@ class LogicalCollection {
|
|||
uint32_t version() const {
|
||||
return _version;
|
||||
}
|
||||
|
||||
void setVersion(CollectionVersions version) { _version = version; }
|
||||
|
||||
uint32_t internalVersion() const;
|
||||
|
||||
|
|
|
@ -308,6 +308,8 @@ arangodb::LogicalCollection* TRI_vocbase_t::createCollectionWorker(
|
|||
cid = collection->cid();
|
||||
|
||||
collection->setStatus(TRI_VOC_COL_STATUS_LOADED);
|
||||
// set collection version to 3.1, as the collection is just created
|
||||
collection->setVersion(LogicalCollection::VERSION_31);
|
||||
|
||||
if (writeMarker) {
|
||||
collection->toVelocyPack(builder, false);
|
||||
|
@ -1302,7 +1304,7 @@ void TRI_SanitizeObjectWithEdges(VPackSlice const slice, VPackBuilder& builder)
|
|||
|
||||
/// @brief Convert a revision ID to a string
|
||||
constexpr static TRI_voc_rid_t tickLimit
|
||||
= static_cast<TRI_voc_rid_t>(2016 - 1970) * 1000 * 60 * 60 * 24 * 365;
|
||||
= static_cast<TRI_voc_rid_t>(2016ULL - 1970ULL) * 1000ULL * 60ULL * 60ULL * 24ULL * 365ULL;
|
||||
|
||||
std::string TRI_RidToString(TRI_voc_rid_t rid) {
|
||||
if (rid <= tickLimit) {
|
||||
|
|
Loading…
Reference in New Issue