![]() |
Storage Engine API
|
Manages the contents of a document in the KVCatalog used to restrict downgrade compatibility. More...
#include <kv_catalog_feature_tracker.h>
Manages the contents of a document in the KVCatalog used to restrict downgrade compatibility.
When a new feature is enabled on a collection or index in the data files, a bit is set in one of the fields of the document. Older versions won't recognize this bit and will fail to start up as a result.
The inserted document serves a similar purpose to the DataFileVersion class used with the MMAPv1 storage engine.
Classes | |
struct | FeatureBits |
Public Types | |
enum | NonRepairableFeature : std::uint64_t { NonRepairableFeature::kCollation = 1 << 0, NonRepairableFeature::kNextFeatureBit = 1 << 1 } |
Bit flags representing whether a particular feature is enabled on a least one collection or index in the data files. More... | |
enum | RepairableFeature : std::uint64_t { RepairableFeature::kPathLevelMultikeyTracking = 1 << 0, RepairableFeature::kNextFeatureBit = 1 << 1 } |
Bit flags representing whether a particular feature is enabled on a least one collection or index in the data files. More... | |
using | NonRepairableFeatureMask = std::underlying_type< NonRepairableFeature >::type |
using | RepairableFeatureMask = std::underlying_type< RepairableFeature >::type |
Public Member Functions | |
Status | isCompatibleWithCurrentCode (OperationContext *opCtx) const |
Returns whethers the data files are compatible with the current code: More... | |
bool | isNonRepairableFeatureInUse (OperationContext *opCtx, NonRepairableFeature feature) const |
Returns true if 'feature' is tracked in the document, and returns false otherwise. More... | |
void | markNonRepairableFeatureAsInUse (OperationContext *opCtx, NonRepairableFeature feature) |
Sets the specified non-repairable feature as being enabled on at least one collection or index in the data files. More... | |
void | markNonRepairableFeatureAsNotInUse (OperationContext *opCtx, NonRepairableFeature feature) |
Sets the specified non-repairable feature as not being enabled on any collection or index in the data files. More... | |
bool | isRepairableFeatureInUse (OperationContext *opCtx, RepairableFeature feature) const |
Returns true if 'feature' is tracked in the document, and returns false otherwise. More... | |
void | markRepairableFeatureAsInUse (OperationContext *opCtx, RepairableFeature feature) |
Sets the specified repairable feature as being enabled on at least one collection or index in the data files. More... | |
void | markRepairableFeatureAsNotInUse (OperationContext *opCtx, RepairableFeature feature) |
Sets the specified repairable feature as not being enabled on any collection or index in the data files. More... | |
void | setUsedNonRepairableFeaturesMaskForTestingOnly (NonRepairableFeatureMask mask) |
void | setUsedRepairableFeaturesMaskForTestingOnly (RepairableFeatureMask mask) |
FeatureBits | getInfo (OperationContext *opCtx) const |
void | putInfo (OperationContext *opCtx, const FeatureBits &versionInfo) |
Static Public Member Functions | |
static bool | isFeatureDocument (BSONObj obj) |
Returns true if 'obj' represents the contents of the feature document that was previously inserted into the KVCatalog, and returns false otherwise. More... | |
static std::unique_ptr< FeatureTracker > | get (OperationContext *opCtx, KVCatalog *catalog, RecordId rid) |
Returns a FeatureTracker instance to manage the contents of the feature document located at 'rid' in the record store 'catalog->_rs'. More... | |
static std::unique_ptr< FeatureTracker > | create (OperationContext *opCtx, KVCatalog *catalog) |
Returns a FeatureTracker instance to manage the contents of a feature document. More... | |
Private Member Functions | |
FeatureTracker (KVCatalog *catalog, RecordId rid) | |
Private Attributes | |
KVCatalog * | _catalog |
RecordId | _rid |
NonRepairableFeatureMask | _usedNonRepairableFeaturesMask |
RepairableFeatureMask | _usedRepairableFeaturesMask |
using mongo::KVCatalog::FeatureTracker::NonRepairableFeatureMask = std::underlying_type<NonRepairableFeature>::type |
using mongo::KVCatalog::FeatureTracker::RepairableFeatureMask = std::underlying_type<RepairableFeature>::type |
|
strong |
Bit flags representing whether a particular feature is enabled on a least one collection or index in the data files.
Features included in this enumeration always require user intervention on downgrade.
The next feature added to this enumeration should use the current value of 'kNextFeatureBit', and 'kNextFeatureBit' should be changed to the next largest power of two.
Enumerator | |
---|---|
kCollation | |
kNextFeatureBit |
|
strong |
Bit flags representing whether a particular feature is enabled on a least one collection or index in the data files.
Features included in this enumeration either (a) don't require user intervention on downgrade, or (b) are no longer enabled if –repair is done with an older version.
The next feature added to this enumeration should use the current value of 'kNextFeatureBit', and 'kNextFeatureBit' should be changed to the next largest power of two.
Enumerator | |
---|---|
kPathLevelMultikeyTracking | |
kNextFeatureBit |
|
inlineprivate |
|
static |
Returns a FeatureTracker instance to manage the contents of a feature document.
The feature document isn't inserted into 'rs' as a result of calling this function. Instead, the feature document is inserted into 'rs' when putInfo() is first called.
It is invalid to call this function when isFeatureDocument() returns true for some document in the record store 'catalog->_rs'.
|
static |
Returns a FeatureTracker instance to manage the contents of the feature document located at 'rid' in the record store 'catalog->_rs'.
It is invalid to call this function when isFeatureDocument() returns false for the record data associated with 'rid'.
KVCatalog::FeatureTracker::FeatureBits mongo::KVCatalog::FeatureTracker::getInfo | ( | OperationContext * | opCtx | ) | const |
Status mongo::KVCatalog::FeatureTracker::isCompatibleWithCurrentCode | ( | OperationContext * | opCtx | ) | const |
Returns whethers the data files are compatible with the current code:
|
static |
bool mongo::KVCatalog::FeatureTracker::isNonRepairableFeatureInUse | ( | OperationContext * | opCtx, |
NonRepairableFeature | feature | ||
) | const |
Returns true if 'feature' is tracked in the document, and returns false otherwise.
bool mongo::KVCatalog::FeatureTracker::isRepairableFeatureInUse | ( | OperationContext * | opCtx, |
RepairableFeature | feature | ||
) | const |
Returns true if 'feature' is tracked in the document, and returns false otherwise.
void mongo::KVCatalog::FeatureTracker::markNonRepairableFeatureAsInUse | ( | OperationContext * | opCtx, |
NonRepairableFeature | feature | ||
) |
Sets the specified non-repairable feature as being enabled on at least one collection or index in the data files.
void mongo::KVCatalog::FeatureTracker::markNonRepairableFeatureAsNotInUse | ( | OperationContext * | opCtx, |
NonRepairableFeature | feature | ||
) |
Sets the specified non-repairable feature as not being enabled on any collection or index in the data files.
void mongo::KVCatalog::FeatureTracker::markRepairableFeatureAsInUse | ( | OperationContext * | opCtx, |
RepairableFeature | feature | ||
) |
Sets the specified repairable feature as being enabled on at least one collection or index in the data files.
void mongo::KVCatalog::FeatureTracker::markRepairableFeatureAsNotInUse | ( | OperationContext * | opCtx, |
RepairableFeature | feature | ||
) |
Sets the specified repairable feature as not being enabled on any collection or index in the data files.
void mongo::KVCatalog::FeatureTracker::putInfo | ( | OperationContext * | opCtx, |
const FeatureBits & | versionInfo | ||
) |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |