mongo::dur::DurableImpl Class Reference

#include <dur.h>

Inheritance diagram for mongo::dur::DurableImpl:
Inheritance graph
[legend]

List of all members.

Private Member Functions

bool awaitCommit ()
bool commitIfNeeded ()
bool commitNow ()
void createdFile (string filename, unsigned long long len)
void declareWriteIntent (void *, unsigned)
void setNoJournal (void *dst, void *src, unsigned len)
void syncDataAndTruncateJournal ()
void * writingAtOffset (void *buf, unsigned ofs, unsigned len)
void * writingPtr (void *x, unsigned len)
void * writingRangesAtOffsets (void *buf, const vector< pair< long long, unsigned > > &ranges)

Detailed Description

Definition at line 181 of file dur.h.


Member Function Documentation

bool mongo::dur::DurableImpl::awaitCommit (  )  [private, virtual]

Wait for acknowledgement of the next group commit.

Returns:
true if --dur is on. There will be delay.
false if --dur is off.

Implements mongo::dur::DurableInterface.

bool mongo::dur::DurableImpl::commitIfNeeded (  )  [private, virtual]

Commit if enough bytes have been modified. Current threshold is 50MB

The idea is that long running write operations that dont yield (like creating an index or update with $atomic) can call this whenever the db is in a sane state and it will prevent commits from growing too large.

Returns:
true if commited

Implements mongo::dur::DurableInterface.

bool mongo::dur::DurableImpl::commitNow (  )  [private, virtual]

Commit immediately.

Generally, you do not want to do this often, as highly granular committing may affect performance.

Does not return until the commit is complete.

You must be at least read locked when you call this. Ideally, you are not write locked and then read operations can occur concurrently.

Returns:
true if --dur is on.
false if --dur is off. (in which case there is action)

Implements mongo::dur::DurableInterface.

void mongo::dur::DurableImpl::createdFile ( string  filename,
unsigned long long  len 
) [private, virtual]

Declare that a file has been created Normally writes are applied only after journaling, for safety. But here the file is created first, and the journal will just replay the creation if the create didn't happen because of crashing.

Implements mongo::dur::DurableInterface.

void mongo::dur::DurableImpl::declareWriteIntent ( void *  x,
unsigned  len 
) [private, virtual]

declare write intent; should already be in the write view to work correctly when testIntent is true. if you aren't, use writingPtr() instead.

Implements mongo::dur::DurableInterface.

void mongo::dur::DurableImpl::setNoJournal ( void *  dst,
void *  src,
unsigned  len 
) [private, virtual]

write something that doesn't have to be journaled, as this write is "unimportant". a good example is paddingFactor. can be thought of as memcpy(dst,src,len) the dur implementation acquires a mutex in this method, so do not assume it is faster without measuring!

Implements mongo::dur::DurableInterface.

void mongo::dur::DurableImpl::syncDataAndTruncateJournal (  )  [private, virtual]

Commits pending changes, flushes all changes to main data files, then removes the journal.

This is useful as a "barrier" to ensure that writes before this call will never go through recovery and be applied to files that have had changes made after this call applied.

Implements mongo::dur::DurableInterface.

void* mongo::dur::DurableImpl::writingAtOffset ( void *  buf,
unsigned  ofs,
unsigned  len 
) [private, virtual]

declare intent to write

Parameters:
ofs offset within buf at which we will write
len the length at ofs we will write
Returns:
new buffer pointer. this is modified when testIntent is true.

Implements mongo::dur::DurableInterface.

void* mongo::dur::DurableImpl::writingPtr ( void *  x,
unsigned  len 
) [private, virtual]

Declarations of write intent.

Use these methods to declare "i'm about to write to x and it should be logged for redo."

Failure to call writing...() is checked in _DEBUG mode by using a read only mapped view (i.e., you'll segfault if the code is covered in that situation). The _DEBUG check doesn't verify that your length is correct though. declare intent to write to x for up to len

Returns:
pointer where to write. this is modified when testIntent is true.

Implements mongo::dur::DurableInterface.

void* mongo::dur::DurableImpl::writingRangesAtOffsets ( void *  buf,
const vector< pair< long long, unsigned > > &  ranges 
) [private, virtual]

declare intent to write

Parameters:
ranges vector of pairs representing ranges. Each pair comprises an offset from buf where a range begins, then the range length.
Returns:
new buffer pointer. this is modified when testIntent is true.

Implements mongo::dur::DurableInterface.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


mongodb
Author(s): Nate Koenig
autogenerated on Fri Jan 11 12:15:58 2013