#include <dur.h>
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) |
Definition at line 168 of file dur.h.
bool mongo::dur::NonDurableImpl::awaitCommit | ( | ) | [inline, private, virtual] |
Wait for acknowledgement of the next group commit.
Implements mongo::dur::DurableInterface.
bool mongo::dur::NonDurableImpl::commitIfNeeded | ( | ) | [inline, 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.
Implements mongo::dur::DurableInterface.
bool mongo::dur::NonDurableImpl::commitNow | ( | ) | [inline, 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.
Implements mongo::dur::DurableInterface.
void mongo::dur::NonDurableImpl::createdFile | ( | string | filename, | |
unsigned long long | len | |||
) | [inline, 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::NonDurableImpl::declareWriteIntent | ( | void * | x, | |
unsigned | len | |||
) | [inline, 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::NonDurableImpl::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::NonDurableImpl::syncDataAndTruncateJournal | ( | ) | [inline, 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::NonDurableImpl::writingAtOffset | ( | void * | buf, | |
unsigned | ofs, | |||
unsigned | len | |||
) | [inline, private, virtual] |
declare intent to write
ofs | offset within buf at which we will write | |
len | the length at ofs we will write |
Implements mongo::dur::DurableInterface.
void* mongo::dur::NonDurableImpl::writingPtr | ( | void * | x, | |
unsigned | len | |||
) | [inline, 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
Implements mongo::dur::DurableInterface.
void* mongo::dur::NonDurableImpl::writingRangesAtOffsets | ( | void * | buf, | |
const vector< pair< long long, unsigned > > & | ranges | |||
) | [inline, private, virtual] |
declare intent to write
ranges | vector of pairs representing ranges. Each pair comprises an offset from buf where a range begins, then the range length. |
Implements mongo::dur::DurableInterface.