Class MultiVersionConcurrencyControl
java.lang.Object
org.apache.hadoop.hbase.regionserver.MultiVersionConcurrencyControl
Manages the read/write consistency. This provides an interface for readers to determine what
 entries to ignore, and a mechanism for writers to obtain new write numbers, then "commit" the new
 writes for readers to read (thus forming atomic transactions).
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classWrite number and whether write has completed given out at start of a write transaction.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final longprivate static final org.slf4j.Loggerstatic final longRepresents no value, or not set.(package private) final AtomicLongprivate static final longprivate final Object(package private) final String(package private) final AtomicLongprivate final LinkedList<MultiVersionConcurrencyControl.WriteEntry>
- 
Constructor SummaryConstructorsConstructorDescriptionMultiVersionConcurrencyControl(long startPoint) Construct and set read point.MultiVersionConcurrencyControl(String regionName) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidadvanceTo(long newStartPoint) Step the MVCC forward on to a new read/write basis.voidawait()Wait until the read point catches up to the write point; i.e.begin()Callbegin(Runnable)with an emptyRunnable.Start a write transaction.booleancomplete(MultiVersionConcurrencyControl.WriteEntry writeEntry) Mark theMultiVersionConcurrencyControl.WriteEntryas complete and advance the read point as much as possible.voidComplete aMultiVersionConcurrencyControl.WriteEntrythat was created bybegin()then wait until the read point catches up to our write.longlongtoString()(package private) booleantryAdvanceTo(long newStartPoint, long expected) Step the MVCC forward on to a new read/write basis.(package private) voidWait for the global readPoint to advance up to the passed in write entry number.
- 
Field Details- 
LOG
- 
READPOINT_ADVANCE_WAIT_TIME- See Also:
 
- 
regionName
- 
readPoint
- 
writePoint
- 
readWaiters
- 
NONERepresents no value, or not set.- See Also:
 
- 
writeQueue
- 
FIXED_SIZE
 
- 
- 
Constructor Details- 
MultiVersionConcurrencyControlpublic MultiVersionConcurrencyControl()
- 
MultiVersionConcurrencyControl
- 
MultiVersionConcurrencyControlConstruct and set read point. Write point is uninitialized.
 
- 
- 
Method Details- 
advanceToStep the MVCC forward on to a new read/write basis.
- 
tryAdvanceToStep the MVCC forward on to a new read/write basis.- Parameters:
- newStartPoint- Point to move read and write points to.
- expected- If not -1 (#NONE)
- Returns:
- Returns false if expectedis not equal to the currentreadPointor ifstartPointis less than currentreadPoint
 
- 
beginCallbegin(Runnable)with an emptyRunnable.
- 
beginStart a write transaction. Create a newMultiVersionConcurrencyControl.WriteEntrywith a new write number and add it to our queue of ongoing writes. Return this WriteEntry instance. To complete the write transaction and wait for it to be visible, callcompleteAndWait(WriteEntry). If the write failed, callcomplete(WriteEntry)so we can clean up AFTER removing ALL trace of the failed write transaction.The actionwill be executed under the lock which means it can keep the same order with mvcc.
- 
awaitWait until the read point catches up to the write point; i.e. wait on all outstanding mvccs to complete.
- 
completeAndWaitComplete aMultiVersionConcurrencyControl.WriteEntrythat was created bybegin()then wait until the read point catches up to our write. At the end of this call, the global read point is at least as large as the write point of the passed in WriteEntry. Thus, the write is visible to MVCC readers.
- 
completeMark theMultiVersionConcurrencyControl.WriteEntryas complete and advance the read point as much as possible. Call this even if the write has FAILED (AFTER backing out the write transaction changes completely) so we can clean up the outstanding transaction. How much is the read point advanced? Let S be the set of all write numbers that are completed. Set the read point to the highest numbered write of S.- Returns:
- true if e is visible to MVCC readers (that is, readpoint >= e.writeNumber)
 
- 
waitForReadWait for the global readPoint to advance up to the passed in write entry number.
- 
toString
- 
getReadPoint
- 
getWritePoint
 
-