本文整理汇总了C++中DiskLoc::assertOk方法的典型用法代码示例。如果您正苦于以下问题:C++ DiskLoc::assertOk方法的具体用法?C++ DiskLoc::assertOk怎么用?C++ DiskLoc::assertOk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiskLoc
的用法示例。
在下文中一共展示了DiskLoc::assertOk方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _createExtentInFile
Extent* ExtentManager::_createExtentInFile( int fileNo, DataFile* f,
const char* ns, int size, bool newCapped,
bool enforceQuota ) {
size = ExtentManager::quantizeExtentSize( size );
if ( enforceQuota ) {
if ( fileIndexExceedsQuota( ns, fileNo - 1 ) ) {
if ( cc().hasWrittenThisPass() ) {
warning() << "quota exceeded, but can't assert "
<< " going over quota for: " << ns << " " << fileNo << endl;
}
else {
_quotaExceeded();
}
}
}
massert( 10358, "bad new extent size", size >= Extent::minSize() && size <= Extent::maxSize() );
DiskLoc loc = f->allocExtentArea( size );
loc.assertOk();
Extent *e = getExtent( loc, false );
verify( e );
DiskLoc emptyLoc = getDur().writing(e)->init(ns, size, fileNo, loc.getOfs(), newCapped);
addNewExtentToNamespace(ns, e, loc, emptyLoc, newCapped);
LOG(1) << "ExtentManager: creating new extent for: " << ns << " in file: " << fileNo
<< " size: " << size << endl;
return e;
}
示例2: warning
DiskLoc MmapV1ExtentManager::_createExtentInFile( TransactionExperiment* txn,
int fileNo,
DataFile* f,
int size,
int maxFileNoForQuota ) {
size = MmapV1ExtentManager::quantizeExtentSize( size );
if ( maxFileNoForQuota > 0 && fileNo - 1 >= maxFileNoForQuota ) {
if ( cc().hasWrittenSinceCheckpoint() ) {
warning() << "quota exceeded, but can't assert" << endl;
}
else {
_quotaExceeded();
}
}
massert( 10358, "bad new extent size", size >= minSize() && size <= maxSize() );
DiskLoc loc = f->allocExtentArea( txn, size );
loc.assertOk();
Extent *e = getExtent( loc, false );
verify( e );
*txn->writing(&e->magic) = Extent::extentSignature;
*txn->writing(&e->myLoc) = loc;
*txn->writing(&e->length) = size;
return loc;
}
示例3: _createExtentInFile
DiskLoc ExtentManager::_createExtentInFile( int fileNo, DataFile* f,
int size, int maxFileNoForQuota ) {
size = ExtentManager::quantizeExtentSize( size );
if ( maxFileNoForQuota > 0 && fileNo - 1 >= maxFileNoForQuota ) {
if ( cc().hasWrittenThisPass() ) {
warning() << "quota exceeded, but can't assert" << endl;
}
else {
_quotaExceeded();
}
}
massert( 10358, "bad new extent size", size >= Extent::minSize() && size <= Extent::maxSize() );
DiskLoc loc = f->allocExtentArea( size );
loc.assertOk();
Extent *e = getExtent( loc, false );
verify( e );
getDur().writing(e)->init("", size, fileNo, loc.getOfs(), false);
return loc;
}
示例4: massert
DiskLoc MmapV1ExtentManager::_createExtentInFile(
OperationContext* txn, int fileNo, DataFile* f, int size, bool enforceQuota) {
_checkQuota(enforceQuota, fileNo - 1);
massert(10358, "bad new extent size", size >= minSize() && size <= maxSize());
DiskLoc loc = f->allocExtentArea(txn, size);
loc.assertOk();
Extent* e = getExtent(loc, false);
verify(e);
*txn->recoveryUnit()->writing(&e->magic) = Extent::extentSignature;
*txn->recoveryUnit()->writing(&e->myLoc) = loc;
*txn->recoveryUnit()->writing(&e->length) = size;
return loc;
}
示例5: operator
void operator()( DBClientCursorBatchIterator &i ) {
Lock::GlobalWrite lk;
if ( context ) {
context->relocked();
}
while( i.moreInCurrentBatch() ) {
if ( n % 128 == 127 /*yield some*/ ) {
time_t now = time(0);
if( now - lastLog >= 60 ) {
// report progress
if( lastLog )
log() << "clone " << to_collection << ' ' << n << endl;
lastLog = now;
}
mayInterrupt( _mayBeInterrupted );
dbtempreleaseif t( _mayYield );
}
BSONObj tmp = i.nextSafe();
/* assure object is valid. note this will slow us down a little. */
if ( !tmp.valid() ) {
stringstream ss;
ss << "Cloner: skipping corrupt object from " << from_collection;
BSONElement e = tmp.firstElement();
try {
e.validate();
ss << " firstElement: " << e;
}
catch( ... ) {
ss << " firstElement corrupt";
}
out() << ss.str() << endl;
continue;
}
++n;
BSONObj js = tmp;
if ( isindex ) {
verify(nsToCollectionSubstring(from_collection) == "system.indexes");
js = fixindex(tmp);
storedForLater->push_back( js.getOwned() );
continue;
}
try {
DiskLoc loc = theDataFileMgr.insertWithObjMod(to_collection, js);
loc.assertOk();
if ( logForRepl )
logOp("i", to_collection, js);
getDur().commitIfNeeded();
}
catch( UserException& e ) {
error() << "error: exception cloning object in " << from_collection << ' ' << e.what() << " obj:" << js.toString() << '\n';
throw;
}
RARELY if ( time( 0 ) - saveLast > 60 ) {
log() << n << " objects cloned so far from collection " << from_collection << endl;
saveLast = time( 0 );
}
}
}