|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.btree.view.FusedView
com.bigdata.btree.isolation.IsolatedFusedView
public class IsolatedFusedView
An index (or index partition) that has been isolated by a transaction. Isolation is achieved by the following mechanisms:
BTree visible only to that transaction.IConflictResolver.
Note: The timestamp from which the post-commit state of the transaction may
be read IS NOT defined for an IBigdataFederation. It is not possible
to define this timestamp without requiring concurrent commit processing to be
paused on all data services on which the transaction has written, which is
viewed as too high a cost. Instead, the commit timestamp is the state from
which you can read the data written by the transaction. Reads on tuples NOT
updated by the transaction MAY have been changed by concurrent transactions.
ITx.UNISOLATED AbstractTask which handles this process.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.bigdata.btree.view.FusedView |
|---|
FusedView.FusedBloomFilter |
| Field Summary |
|---|
| Fields inherited from class com.bigdata.btree.view.FusedView |
|---|
ERR_RANGE_COUNT_EXCEEDS_MAX_LONG, log |
| Fields inherited from interface com.bigdata.btree.IRangeQuery |
|---|
ALL, CURSOR, DEFAULT, DELETED, FIXED_LENGTH_SUCCESSOR, KEYS, NONE, PARALLEL, READONLY, REMOVEALL, REVERSE, VALS |
| Constructor Summary | |
|---|---|
IsolatedFusedView(long timestamp,
AbstractBTree[] sources)
Constructor may be used either for a fully isolated transaction or an unisolated operation. |
|
| Method Summary | |
|---|---|
ICounter |
getCounter()
Counters are disallowed for isolated view. |
BTree |
getWriteSet()
The isolated write set (the place where we record the intention of the transaction). |
byte[] |
insert(byte[] key,
byte[] val)
Write an entry for the key on the write set. |
boolean |
isEmptyWriteSet()
True iff there are no writes on this isolated index. |
void |
mergeDown(long revisionTime,
AbstractBTree[] groundStateSources)
Merge the transaction scope index onto the then current unisolated index. |
byte[] |
remove(byte[] key)
Write a deleted entry for the key on the write set. |
boolean |
validate(AbstractBTree[] groundStateSources)
Validate changes made to the index within a transaction against the last committed state of the index in the global scope. |
| Methods inherited from class com.bigdata.btree.view.FusedView |
|---|
assertNotReadOnly, contains, contains, getBloomFilter, getCounters, getIndexMetadata, getMutableBTree, getResourceMetadata, getSourceCount, getSources, insert, lookup, lookup, lookup, lookup, rangeCount, rangeCount, rangeCountExact, rangeCountExactWithDeleted, rangeIterator, rangeIterator, rangeIterator, remove, submit, submit, submit, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IsolatedFusedView(long timestamp,
AbstractBTree[] sources)
Reads will read through the writeSet and then the resource(s) in the groundState in the order in which they are given. A read is satisified by the first resource containing an index entry for the search key.
Writes will first read through looking for a @todo javadoc
timestamp - The timestamp associated with the groundState.sources - An ordered array of sources comprised of the BTree
that will absorb writes and the historical ground state.| Method Detail |
|---|
public BTree getWriteSet()
BTree at
index zero(0) of sources in the view.
FusedView.getMutableBTree()public boolean isEmptyWriteSet()
public final ICounter getCounter()
getCounter in interface IIndexgetCounter in class FusedViewUnsupportedOperationException - alwaysAtomicInteger. However additional care needs to be taken
to ensure that the counter value is persisted if it is changed (by
updating the BTree Checkpoint record). The cases
where the tx bumps the counter need to be carefully examined since
it could force the write of the unisolated btree when we actually
do not want to commit the btree - some kind of locking may be
required. So, for now, this is disabled.
public byte[] insert(byte[] key,
byte[] val)
insert in interface ISimpleBTreeinsert in class FusedViewkey - The key.val - The value (may be null).
null if the
key was not found or if the previous entry for that key was
marked as deleted.public byte[] remove(byte[] key)
remove in interface ISimpleBTreeremove in class FusedViewkey - The key.
null if the key
was not found or if the previous entry under that key was marked
as deleted.public boolean validate(AbstractBTree[] groundStateSources)
Validate changes made to the index within a transaction against the last
committed state of the index in the global scope. In general there are
two kinds of conflicts: read-write conflicts and write-write conflicts.
Read-write conflicts are handled by NEVER overwriting an existing version
(an MVCC style strategy). Write-write conflicts are detected by backward
validation against the last committed state of the journal. A write-write
conflict exists IFF the version counter on the transaction index entry
differs from the version counter in the global index scope. Once
detected, the resolution of a write-write conflict is delegated to a
conflict resolver. If a write-write conflict
can not be validated, then validation will fail and the transaction must
abort.
Validation occurs as part of the prepare/commit protocol. Concurrent transactions MAY continue to run without limitation. A concurrent commit (if permitted) would force re-validation since the transaction MUST now be validated against the new baseline. (It is possible that this validation could be optimized.)
The version counters used to detect write-write conflicts are incremented
during the commit as part of the #mergeDown() of the
IsolatedFusedView onto the corresponding unisolated indices in
the global scope.
groundStateSources - The ordered view of the unisolated index. This MUST be the
current view of the ground state as of when the transaction is
validated (NOT when it was created). This view WILL NOT the
same as the groundState specified to the constructor if
intervening transactions have committed on the index.
public void mergeDown(long revisionTime,
AbstractBTree[] groundStateSources)
Merge the transaction scope index onto the then current unisolated index.
Note: This method is invoked by a transaction during commit processing to
merge the write set of an IsolatedFusedView into the global
scope. This operation does NOT check for conflicts. The pre-condition is
that the transaction has already been validated (hence, there will be no
conflicts).
Note: This method is also responsible for updating the version timestamps that are used to detect write-write conflicts during validation - they are set to the revisionTime.
revisionTime - The revision timestamp assigned to the commit point of the
transaction.groundStateSources - The ordered view of the unisolated index. This MUST be the
current view of the ground state as of when the transaction is
validated (NOT when it was created). This view WILL NOT the
same as the groundState specified to the constructor if
intervening transactions have committed on the index.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||