Storage Engine API
mongo::WiredTigerUtil Class Reference

#include <wiredtiger_util.h>

Classes

class  ErrorAccumulator
 

Public Member Functions

template<typename ResultType >
ResultType _castStatisticsValue (uint64_t statisticsValue)
 
template<typename ResultType >
ResultType _castStatisticsValue (uint64_t statisticsValue, ResultType maximumResultType)
 

Static Public Member Functions

static void fetchTypeAndSourceURI (OperationContext *opCtx, const std::string &tableUri, std::string *type, std::string *source)
 Fetch the type and source fields out of the colgroup metadata. More...
 
static Status exportTableToBSON (WT_SESSION *s, const std::string &uri, const std::string &config, BSONObjBuilder *bob)
 Reads contents of table using URI and exports all keys to BSON as string elements. More...
 
static void appendSnapshotWindowSettings (WiredTigerKVEngine *engine, WiredTigerSession *session, BSONObjBuilder *bob)
 Appends information about the storage engine's currently available snapshots and the settings that affect that window of maintained history. More...
 
static StatusWith< std::string > getMetadata (OperationContext *opCtx, StringData uri)
 Gets entire metadata string for collection/index at URI. More...
 
static Status getApplicationMetadata (OperationContext *opCtx, StringData uri, BSONObjBuilder *bob)
 Reads app_metadata for collection/index at URI as a BSON document. More...
 
static StatusWith< BSONObj > getApplicationMetadata (OperationContext *opCtx, StringData uri)
 
static StatusWith< int64_t > checkApplicationMetadataFormatVersion (OperationContext *opCtx, StringData uri, int64_t minimumVersion, int64_t maximumVersion)
 Validates formatVersion in application metadata for 'uri'. More...
 
static Status checkTableCreationOptions (const BSONElement &configElem)
 Validates the 'configString' specified as a collection or index creation option. More...
 
static StatusWith< uint64_t > getStatisticsValue (WT_SESSION *session, const std::string &uri, const std::string &config, int statisticsKey)
 Reads individual statistics using URI. More...
 
template<typename ResultType >
static StatusWith< ResultType > getStatisticsValueAs (WT_SESSION *session, const std::string &uri, const std::string &config, int statisticsKey)
 Reads individual statistics using URI and casts to type ResultType. More...
 
template<typename ResultType >
static StatusWith< ResultType > getStatisticsValueAs (WT_SESSION *session, const std::string &uri, const std::string &config, int statisticsKey, ResultType maximumResultType)
 Reads individual statistics using URI and casts to type ResultType. More...
 
static int64_t getIdentSize (WT_SESSION *s, const std::string &uri)
 
static size_t getCacheSizeMB (double requestedCacheSizeGB)
 Return amount of memory to use for the WiredTiger cache based on either the startup option chosen or the amount of available memory on the host. More...
 
static WT_EVENT_HANDLER defaultEventHandlers ()
 Returns a WT_EVENT_HANDER with MongoDB's default handlers. More...
 
static int verifyTable (OperationContext *opCtx, const std::string &uri, std::vector< std::string > *errors=NULL)
 Calls WT_SESSION::validate() on a side-session to ensure that your current transaction isn't left in an invalid state. More...
 
static bool useTableLogging (NamespaceString ns, bool replEnabled)
 
static Status setTableLogging (OperationContext *opCtx, const std::string &uri, bool on)
 
static Status setTableLogging (WT_SESSION *session, const std::string &uri, bool on)
 

Private Member Functions

 MONGO_DISALLOW_COPYING (WiredTigerUtil)
 
 WiredTigerUtil ()
 

Static Private Member Functions

template<typename T >
static T _castStatisticsValue (uint64_t statisticsValue)
 Casts unsigned 64-bit statistics value to T. More...
 
template<typename T >
static T _castStatisticsValue (uint64_t statisticsValue, T maximumResultType)
 Casts unsigned 64-bit statistics value to T. More...
 

Constructor & Destructor Documentation

◆ WiredTigerUtil()

mongo::WiredTigerUtil::WiredTigerUtil ( )
private

Member Function Documentation

◆ _castStatisticsValue() [1/4]

template<typename T >
static T mongo::WiredTigerUtil::_castStatisticsValue ( uint64_t  statisticsValue)
staticprivate

Casts unsigned 64-bit statistics value to T.

If original value exceeds maximum value of T, return max(T).

◆ _castStatisticsValue() [2/4]

template<typename T >
static T mongo::WiredTigerUtil::_castStatisticsValue ( uint64_t  statisticsValue,
maximumResultType 
)
staticprivate

Casts unsigned 64-bit statistics value to T.

If original value exceeds 'maximumResultType', return 'maximumResultType'.

◆ _castStatisticsValue() [3/4]

template<typename ResultType >
ResultType mongo::WiredTigerUtil::_castStatisticsValue ( uint64_t  statisticsValue)

◆ _castStatisticsValue() [4/4]

template<typename ResultType >
ResultType mongo::WiredTigerUtil::_castStatisticsValue ( uint64_t  statisticsValue,
ResultType  maximumResultType 
)

◆ appendSnapshotWindowSettings()

void mongo::WiredTigerUtil::appendSnapshotWindowSettings ( WiredTigerKVEngine engine,
WiredTigerSession session,
BSONObjBuilder *  bob 
)
static

Appends information about the storage engine's currently available snapshots and the settings that affect that window of maintained history.

"snapshot-window-settings" : { "cache pressure percentage threshold" : <num>, "current cache pressure percentage" : <num>, "max target available snapshots window size in seconds" : <num>, "target available snapshots window size in seconds" : <num>, "current available snapshots window size in seconds" : <num>, "latest majority snapshot timestamp available" : <num>, "oldest majority snapshot timestamp available" : <num> }

◆ checkApplicationMetadataFormatVersion()

StatusWith< int64_t > mongo::WiredTigerUtil::checkApplicationMetadataFormatVersion ( OperationContext *  opCtx,
StringData  uri,
int64_t  minimumVersion,
int64_t  maximumVersion 
)
static

Validates formatVersion in application metadata for 'uri'.

Version must be numeric and be in the range [minimumVersion, maximumVersion]. URI is used in error messages only. Returns actual version.

◆ checkTableCreationOptions()

Status mongo::WiredTigerUtil::checkTableCreationOptions ( const BSONElement &  configElem)
static

Validates the 'configString' specified as a collection or index creation option.

◆ defaultEventHandlers()

WT_EVENT_HANDLER mongo::WiredTigerUtil::defaultEventHandlers ( )
static

Returns a WT_EVENT_HANDER with MongoDB's default handlers.

The default handlers just log so it is recommended that you consider calling them even if you are capturing the output.

There is no default "close" handler. You only need to provide one if you need to call a destructor.

◆ exportTableToBSON()

Status mongo::WiredTigerUtil::exportTableToBSON ( WT_SESSION *  s,
const std::string &  uri,
const std::string &  config,
BSONObjBuilder *  bob 
)
static

Reads contents of table using URI and exports all keys to BSON as string elements.

Additional, adds 'uri' field to output document.

◆ fetchTypeAndSourceURI()

void mongo::WiredTigerUtil::fetchTypeAndSourceURI ( OperationContext *  opCtx,
const std::string &  tableUri,
std::string *  type,
std::string *  source 
)
static

Fetch the type and source fields out of the colgroup metadata.

'tableUri' must be a valid table: uri.

◆ getApplicationMetadata() [1/2]

Status mongo::WiredTigerUtil::getApplicationMetadata ( OperationContext *  opCtx,
StringData  uri,
BSONObjBuilder *  bob 
)
static

Reads app_metadata for collection/index at URI as a BSON document.

◆ getApplicationMetadata() [2/2]

StatusWith< BSONObj > mongo::WiredTigerUtil::getApplicationMetadata ( OperationContext *  opCtx,
StringData  uri 
)
static

◆ getCacheSizeMB()

size_t mongo::WiredTigerUtil::getCacheSizeMB ( double  requestedCacheSizeGB)
static

Return amount of memory to use for the WiredTiger cache based on either the startup option chosen or the amount of available memory on the host.

◆ getIdentSize()

int64_t mongo::WiredTigerUtil::getIdentSize ( WT_SESSION *  s,
const std::string &  uri 
)
static

◆ getMetadata()

StatusWith< std::string > mongo::WiredTigerUtil::getMetadata ( OperationContext *  opCtx,
StringData  uri 
)
static

Gets entire metadata string for collection/index at URI.

◆ getStatisticsValue()

StatusWith< uint64_t > mongo::WiredTigerUtil::getStatisticsValue ( WT_SESSION *  session,
const std::string &  uri,
const std::string &  config,
int  statisticsKey 
)
static

Reads individual statistics using URI.

List of statistics keys WT_STAT_* can be found in wiredtiger.h.

◆ getStatisticsValueAs() [1/2]

template<typename ResultType >
StatusWith< ResultType > mongo::WiredTigerUtil::getStatisticsValueAs ( WT_SESSION *  session,
const std::string &  uri,
const std::string &  config,
int  statisticsKey 
)
static

Reads individual statistics using URI and casts to type ResultType.

Caps statistics value at max(ResultType) in case of overflow.

◆ getStatisticsValueAs() [2/2]

template<typename ResultType >
StatusWith< ResultType > mongo::WiredTigerUtil::getStatisticsValueAs ( WT_SESSION *  session,
const std::string &  uri,
const std::string &  config,
int  statisticsKey,
ResultType  maximumResultType 
)
static

Reads individual statistics using URI and casts to type ResultType.

Caps statistics value at 'maximumResultType'.

◆ MONGO_DISALLOW_COPYING()

mongo::WiredTigerUtil::MONGO_DISALLOW_COPYING ( WiredTigerUtil  )
private

◆ setTableLogging() [1/2]

Status mongo::WiredTigerUtil::setTableLogging ( OperationContext *  opCtx,
const std::string &  uri,
bool  on 
)
static

◆ setTableLogging() [2/2]

Status mongo::WiredTigerUtil::setTableLogging ( WT_SESSION *  session,
const std::string &  uri,
bool  on 
)
static

◆ useTableLogging()

bool mongo::WiredTigerUtil::useTableLogging ( NamespaceString  ns,
bool  replEnabled 
)
static

◆ verifyTable()

int mongo::WiredTigerUtil::verifyTable ( OperationContext *  opCtx,
const std::string &  uri,
std::vector< std::string > *  errors = NULL 
)
static

Calls WT_SESSION::validate() on a side-session to ensure that your current transaction isn't left in an invalid state.

If errors is non-NULL, all error messages will be appended to the array.


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