Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-2823 SCM HA Support
  3. HDDS-4059

SCMStateMachine::applyTransaction() should not invoke TransactionContext.getClientRequest()

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: SCM

      Description

      applyTransaction should not call trx.getClientRequest(), since client request will not be replicated from leader to follower, follower will not be able to update its state machine.

      SCMStateMachine
        applyTransaction()
          final SCMRatisRequest request = SCMRatisRequest.decode(
              trx.getClientRequest().getMessage());

       

      Instead, we should call trx.getStateMachineLogEntry()

      SCMStateMachine
        applyTransaction()
          final SCMRatisRequest request = SCMRatisRequest.decode(
              Message.valueOf(trx.getStateMachineLogEntry().getLogData()));

       

      content of client request will be injected to StateMachineEntryProto at leader,

      static StateMachineLogEntryProto toStateMachineLogEntryProto(
          RaftClientRequest request, ByteString logData, ByteString stateMachineData) {
        if (logData == null) {
          logData = request.getMessage().getContent();
        }
        return toStateMachineLogEntryProto(request.getClientId(), request.getCallId(), logData, stateMachineData);
      }
      

       

      and extracted from log entry at follower.

      /**
       * Construct a {@link TransactionContext} from a {@link LogEntryProto}.
       * Used by followers for applying committed entries to the state machine.
       * @param logEntry the log entry to be applied
       */
      public TransactionContextImpl(RaftPeerRole serverRole, StateMachine stateMachine, LogEntryProto logEntry) {
        this(serverRole, stateMachine);
        this.logEntry = logEntry;
        this.smLogEntryProto = logEntry.getStateMachineLogEntry();
      }
      

       

        Attachments

          Activity

            People

            • Assignee:
              glengeng Glen Geng
              Reporter:
              glengeng Glen Geng

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment