NodeIDType
- public class DistTransactor<NodeIDType> extends AbstractTransactor<NodeIDType> implements TXLocker
app, messenger
Constructor and Description |
---|
DistTransactor(AbstractReplicaCoordinator<NodeIDType> coordinator) |
Modifier and Type | Method and Description |
---|---|
protected void |
enqueue(Request request,
boolean noReplyToClient) |
protected java.util.Set<java.net.InetSocketAddress> |
getTxGroup(java.lang.String txid) |
protected boolean |
isLocked(java.lang.String name) |
void |
lock(java.lang.String lockID)
A blocking call that returns upon successfully locking
lockID or
throws a TXException . |
void |
lock(java.lang.String[] lockIDs)
Acquires the locks in the order specified by
lockIDs . |
void |
transact(Transaction tx)
This method is the top-level method initiating a transaction and consists
of the following sequence of steps: (1) create transaction group; (2)
acquire participant group locks; (3) execute transaction operations in
order; (4) issue commit to transaction group; (5) release participant
group locks; (6) delete transaction group.
|
void |
unlock(java.lang.String lockID)
A blocking call that returns upon successfully release
lockID or
throws a TXException . |
void |
unlock(java.lang.String[] lockIDs)
Releases the locks in the order specified by
lockIDs . |
checkpoint, coordinateRequest, createReplicaGroup, deleteFinalState, deleteReplicaGroup, execute, execute, getEpoch, getFinalState, getReplicaGroup, getRequestTypes, getStopRequest, putInitialState, restore
callCallback, createReplicaGroup, execute, getAppRequestTypes, getARARNodesAsString, getARRCNodesAsString, getCallback, getCoordinatorRequestTypes, getMessenger, getMutualAuthAppRequestTypes, getMyID, getRequest, getRequest, getRequest, handleIncoming, hasLargeCheckpoints, registerCoordination, sendAllLazy, setCallback, setLargeCheckpoints, setMessenger, setStopCallback, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMutualAuthRequestTypes, getServerAuthRequestTypes
public DistTransactor(AbstractReplicaCoordinator<NodeIDType> coordinator) throws java.io.IOException
coordinator
- java.io.IOException
public void lock(java.lang.String lockID) throws TXException
lockID
or
throws a TXException
. Locking a group involves synchronously
checkpointing its state and maintaining in memory its locked status.lock
in interface TXLocker
lockID
- TXException
public void lock(java.lang.String[] lockIDs) throws TXException
lockIDs
.lockIDs
- TXException
public void unlock(java.lang.String lockID) throws TXException
lockID
or
throws a TXException
.lockID
- TXException
public void unlock(java.lang.String[] lockIDs) throws TXException
lockIDs
.lockIDs
- TXException
public void transact(Transaction tx) throws TXException
TXException
. The
transaction group acts as the "monitor" group that makes it easy to
reason about the safety property that all participant groups agree on
whether a transaction is committed or aborted and that either decision is
final.
Message complexity: Below, P1 refers to the message complexity of a paxos
operation in the transaction group, P2 to that of a paxos operation in
the largest participant group, and P3 to that in a reconfigurator group;
N1 is the number of transaction steps involving participant groups, N2 is
the number of name create operations, and N3 the number of name delete
operations; M is the distinct number of participant groups (or names)
involved;
(1) 2*P3 + 2/3*P1
(2) N1*P2
(3) (N1+N3)*P2 + 2*(N2+N3)*P3 + 2/3*N2*P2
(4) P1
(5) (N1 + N2 + N3)*P2
(6) P1 + 2*P3
In comparison, simply executing the transaction's steps sequentially
without ensuring any transactional semantics has a message complexity of
(N1+N3)*P2 + 2*(N2+N3)*P3 + 2/3*N2*P2, i.e., just step 3 above. Thus,
transactions roughly increase the message complexity by a factor of 3
(for (lock, execute, unlock) compared to just execute for each operation)
plus a fixed number, a total of ~7, of additional paxos operations across
the transaction or various reconfigurator groups involved.
Optimizations: The overhead of the transaction group can be reduced to
just a single paxos operation with a corresponding liveness cost if we
reuse transaction groups across different transactions. (1) Choosing the
transaction group as a fixed set of active replicas makes transactional
liveness limited by majority availability in that set; (2) Choosing the
transaction group as the set of all active replicas can incur a
prohibitively high overhead for even a single paxos operation as the
total number of active replicas may be much higher than the size of
typical participant groups.tx
- TXException
protected java.util.Set<java.net.InetSocketAddress> getTxGroup(java.lang.String txid) throws java.io.IOException
java.io.IOException
protected boolean isLocked(java.lang.String name)
isLocked
in class AbstractTransactor<NodeIDType>
protected void enqueue(Request request, boolean noReplyToClient)
enqueue
in class AbstractTransactor<NodeIDType>