Storage Engine API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mongo::WiredTigerIndex::UniqueBulkBuilder Class Reference

Bulk builds a unique index. More...

Inheritance diagram for mongo::WiredTigerIndex::UniqueBulkBuilder:
mongo::WiredTigerIndex::BulkBuilder mongo::SortedDataBuilderInterface

Detailed Description

Bulk builds a unique index.

In order to support unique indexes in dupsAllowed mode this class only does an actual insert after it sees a key after the one we are trying to insert. This allows us to gather up all duplicate ids and insert them all together. This is necessary since bulk cursors can only append data.

Public Member Functions

 UniqueBulkBuilder (WiredTigerIndex *idx, OperationContext *opCtx, bool dupsAllowed, KVPrefix prefix)
 
Status addKey (const BSONObj &newKey, const RecordId &id) override
 Adds 'key' to intermediate storage. More...
 
void commit (bool mayInterrupt) override
 Do any necessary work to finish building the tree. More...
 
- Public Member Functions inherited from mongo::WiredTigerIndex::BulkBuilder
 BulkBuilder (WiredTigerIndex *idx, OperationContext *opCtx, KVPrefix prefix)
 
 ~BulkBuilder ()
 
- Public Member Functions inherited from mongo::SortedDataBuilderInterface
virtual ~SortedDataBuilderInterface ()
 

Private Member Functions

Status addKeyTimestampSafe (const BSONObj &newKey, const RecordId &id)
 
Status addKeyTimestampUnsafe (const BSONObj &newKey, const RecordId &id)
 
void doInsert ()
 

Private Attributes

WiredTigerIndex_idx
 
const bool _dupsAllowed
 
KeyString _keyString
 
std::vector< std::pair< RecordId, KeyString::TypeBits > > _records
 
BSONObj _previousKey
 

Additional Inherited Members

- Protected Member Functions inherited from mongo::WiredTigerIndex::BulkBuilder
WT_CURSOR * openBulkCursor (WiredTigerIndex *idx)
 
void setKey (WT_CURSOR *cursor, const WT_ITEM *item)
 
- Protected Attributes inherited from mongo::WiredTigerIndex::BulkBuilder
const Ordering _ordering
 
OperationContext *const _opCtx
 
UniqueWiredTigerSession const _session
 
WT_CURSOR *const _cursor
 
KVPrefix _prefix
 

Constructor & Destructor Documentation

◆ UniqueBulkBuilder()

mongo::WiredTigerIndex::UniqueBulkBuilder::UniqueBulkBuilder ( WiredTigerIndex idx,
OperationContext *  opCtx,
bool  dupsAllowed,
KVPrefix  prefix 
)
inline

Member Function Documentation

◆ addKey()

Status mongo::WiredTigerIndex::UniqueBulkBuilder::addKey ( const BSONObj &  key,
const RecordId &  loc 
)
inlineoverridevirtual

Adds 'key' to intermediate storage.

'key' must be > or >= the last key passed to this function (depends on _dupsAllowed). If this is violated an error Status (ErrorCodes::InternalError) will be returned.

Implements mongo::SortedDataBuilderInterface.

◆ addKeyTimestampSafe()

Status mongo::WiredTigerIndex::UniqueBulkBuilder::addKeyTimestampSafe ( const BSONObj &  newKey,
const RecordId &  id 
)
inlineprivate

◆ addKeyTimestampUnsafe()

Status mongo::WiredTigerIndex::UniqueBulkBuilder::addKeyTimestampUnsafe ( const BSONObj &  newKey,
const RecordId &  id 
)
inlineprivate

◆ commit()

void mongo::WiredTigerIndex::UniqueBulkBuilder::commit ( bool  mayInterrupt)
inlineoverridevirtual

Do any necessary work to finish building the tree.

The default implementation may be used if no commit phase is necessary because addKey always leaves the tree in a valid state.

This is called outside of any WriteUnitOfWork to allow implementations to split this up into multiple units.

Reimplemented from mongo::SortedDataBuilderInterface.

◆ doInsert()

void mongo::WiredTigerIndex::UniqueBulkBuilder::doInsert ( )
inlineprivate

Member Data Documentation

◆ _dupsAllowed

const bool mongo::WiredTigerIndex::UniqueBulkBuilder::_dupsAllowed
private

◆ _idx

WiredTigerIndex* mongo::WiredTigerIndex::UniqueBulkBuilder::_idx
private

◆ _keyString

KeyString mongo::WiredTigerIndex::UniqueBulkBuilder::_keyString
private

◆ _previousKey

BSONObj mongo::WiredTigerIndex::UniqueBulkBuilder::_previousKey
private

◆ _records

std::vector<std::pair<RecordId, KeyString::TypeBits> > mongo::WiredTigerIndex::UniqueBulkBuilder::_records
private

The documentation for this class was generated from the following file: