When we have remote -> local handoff, we will use a
ModifyTransactionRequest, which we need to apply before moving on.
JIRA: CONTROLLER-2022
Change-Id: I04bdfda162d474966b153223c7480fd5b3af8099
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
920660971adda2a58672596e8ce93ac3c42b40bb)
LocalReadWriteProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier,
final DataTreeSnapshot snapshot) {
super(parent, identifier, false);
LocalReadWriteProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier,
final DataTreeSnapshot snapshot) {
super(parent, identifier, false);
- this.modification = (CursorAwareDataTreeModification) snapshot.newModification();
+ modification = (CursorAwareDataTreeModification) snapshot.newModification();
}
LocalReadWriteProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier) {
super(parent, identifier, true);
// This is DONE transaction, this should never be touched
}
LocalReadWriteProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier) {
super(parent, identifier, true);
// This is DONE transaction, this should never be touched
- this.modification = null;
void forwardToLocal(final LocalProxyTransaction successor, final TransactionRequest<?> request,
final Consumer<Response<?, ?>> callback) {
if (request instanceof CommitLocalTransactionRequest) {
void forwardToLocal(final LocalProxyTransaction successor, final TransactionRequest<?> request,
final Consumer<Response<?, ?>> callback) {
if (request instanceof CommitLocalTransactionRequest) {
- Verify.verify(successor instanceof LocalReadWriteProxyTransaction);
- ((LocalReadWriteProxyTransaction) successor).sendRebased((CommitLocalTransactionRequest)request, callback);
- LOG.debug("Forwarded request {} to successor {}", request, successor);
+ verifyLocalReadWrite(successor).sendRebased((CommitLocalTransactionRequest)request, callback);
+ } else if (request instanceof ModifyTransactionRequest) {
+ verifyLocalReadWrite(successor).handleForwardedRemoteRequest(request, callback);
} else {
super.forwardToLocal(successor, request, callback);
} else {
super.forwardToLocal(successor, request, callback);
+ LOG.debug("Forwarded request {} to successor {}", request, successor);
+ }
+
+ private static LocalReadWriteProxyTransaction verifyLocalReadWrite(final LocalProxyTransaction successor) {
+ Verify.verify(successor instanceof LocalReadWriteProxyTransaction, "Unexpected successor %s", successor);
+ return (LocalReadWriteProxyTransaction) successor;