コード例 #1
0
 RecordId _oplogOrderInsertOplog( OperationContext* txn,
                                 scoped_ptr<RecordStore>& rs,
                                 int inc ) {
     Timestamp opTime = Timestamp(5,inc);
     RocksRecordStore* rrs = dynamic_cast<RocksRecordStore*>(rs.get());
     Status status = rrs->oplogDiskLocRegister( txn, opTime );
     ASSERT_OK( status );
     BSONObj obj = BSON( "ts" << opTime );
     StatusWith<RecordId> res = rs->insertRecord( txn, obj.objdata(), obj.objsize(), false );
     ASSERT_OK( res.getStatus() );
     return res.getValue();
 }
コード例 #2
0
 DiskLoc _oplogOrderInsertOplog( OperationContext* txn,
                                 scoped_ptr<RecordStore>& rs,
                                 int inc ) {
     OpTime opTime = OpTime(5,inc);
     WiredTigerRecordStore* wrs = dynamic_cast<WiredTigerRecordStore*>(rs.get());
     Status status = wrs->oplogDiskLocRegister( txn, opTime );
     ASSERT_OK( status );
     BSONObj obj = BSON( "ts" << opTime );
     StatusWith<DiskLoc> res = rs->insertRecord( txn, obj.objdata(), obj.objsize(), false );
     ASSERT_OK( res.getStatus() );
     return res.getValue();
 }
コード例 #3
0
 StatusWith<RecordId> insertBSON(scoped_ptr<OperationContext>& opCtx,
                                scoped_ptr<RecordStore>& rs,
                                const Timestamp& opTime) {
     BSONObj obj = BSON( "ts" << opTime );
     WriteUnitOfWork wuow(opCtx.get());
     RocksRecordStore* rrs = dynamic_cast<RocksRecordStore*>(rs.get());
     invariant( rrs );
     Status status = rrs->oplogDiskLocRegister( opCtx.get(), opTime );
     if (!status.isOK())
         return StatusWith<RecordId>( status );
     StatusWith<RecordId> res = rs->insertRecord(opCtx.get(),
                                                obj.objdata(),
                                                obj.objsize(),
                                                false);
     if (res.isOK())
         wuow.commit();
     return res;
 }