duongkame opened a new pull request, #1106: URL: https://github.com/apache/ratis/pull/1106
## What changes were proposed in this pull request? As discuss in RATIS-2094, the usage of TransactionContext's `getStateMachineLogEntry` and `getStateMachineContext` may cause corruptions when zero-copy is enabled. 1. For stateMachineContext, when TransactionContext is created from `startTransaction(LogEntryProto)`, the `stateMachineContext` should not be created/parsed directly from the LogEntryProto's content (as it would directly refer to the zero-copy buffer without reference count). We should copy `logData` to create this context object. The change in `FileStoreStateMachine` demonstrate this. 2. For `stateMachineLogEntry`, it should be used internally in TransactionContextImpl to form the LogEntryProto. Any subsequent access to `stateMachineLogEntry` should happen via the logEntry, aka via `TransactionContext.getLogEntryRef`. Hence, the API `getStateMachineContext` is deprecated. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/RATIS-2094 ## How was this patch tested? CI -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
