-
Notifications
You must be signed in to change notification settings - Fork 597
HDDS-9369. Avoid deserializing OMRequest multiple times in OzoneManagerStateMachine. #5376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -267,8 +267,7 @@ public TransactionContext startTransaction( | |
| @Override | ||
| public TransactionContext preAppendTransaction(TransactionContext trx) | ||
| throws IOException { | ||
| OMRequest request = OMRatisHelper.convertByteStringToOMRequest( | ||
| trx.getStateMachineLogEntry().getLogData()); | ||
| final OMRequest request = (OMRequest) trx.getStateMachineContext(); | ||
| OzoneManagerProtocolProtos.Type cmdType = request.getCmdType(); | ||
|
|
||
| OzoneManagerPrepareState prepareState = ozoneManager.getPrepareState(); | ||
|
|
@@ -314,7 +313,11 @@ public TransactionContext preAppendTransaction(TransactionContext trx) | |
| @Override | ||
| public CompletableFuture<Message> applyTransaction(TransactionContext trx) { | ||
| try { | ||
| OMRequest request = OMRatisHelper.convertByteStringToOMRequest( | ||
| // For the Leader, the OMRequest is set in trx in startTransaction. | ||
| // For Followers, the OMRequest hast to be converted from the log entry. | ||
| final Object context = trx.getStateMachineContext(); | ||
| final OMRequest request = context != null ? (OMRequest) context | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, the followers need to deserialize. That's OK if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That is correct. |
||
| : OMRatisHelper.convertByteStringToOMRequest( | ||
| trx.getStateMachineLogEntry().getLogData()); | ||
| long trxLogIndex = trx.getLogEntry().getIndex(); | ||
| // In the current approach we have one single global thread executor. | ||
|
|
@@ -554,6 +557,7 @@ private TransactionContext handleStartTransactionRequests( | |
| .setStateMachine(this) | ||
| .setServerRole(RaftProtos.RaftPeerRole.LEADER) | ||
| .setLogData(raftClientRequest.getMessage().getContent()) | ||
| .setStateMachineContext(omRequest) | ||
| .build(); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these validations should be on
startTransactionas well. The creation of UGI is quite expensive as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UGI is only for upgrade
Prepare. Let's don't optimize it here.