-
Notifications
You must be signed in to change notification settings - Fork 504
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
HDDS-11418. leader executor framework #7406
base: LeaderExecutor_Feature_2
Are you sure you want to change the base?
HDDS-11418. leader executor framework #7406
Conversation
public OMResponse submitInternal(OMRequest omRequest, String clientId, long callId) throws ServiceException { | ||
requestInProgress.incrementAndGet(); | ||
RequestContext requestContext = new RequestContext(); | ||
requestContext.setRequest(omRequest); |
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.
Seems redundant
(r, th) -> handleAfterExecution(requestContext, th)); | ||
OmLockOpr.OmLockInfo lockInfo = null; | ||
try { | ||
OMRequestBase requestBase = OmRequestFactory.createClientRequest(omRequest, om); |
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.
Reusing Request name seemed wrong in the original code itself. Request == a bunch of attributes (nouns) and a verb for what needs to be done. These ClientRequest
s embed the entire logic for executing the code. They in essense capture the lamba to be performed for each request.
OMRequestBase requestBase = OmRequestFactory.createClientRequest(omRequest, om); | |
OMRequestBase requestBase = OmRequestFactory.createRequestExecutor(omRequest, om); |
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.
or createRequestProcessors
requestContext.setUuidClientId(clientId); | ||
requestContext.setCallId(callId); | ||
requestContext.setRequestBase(requestBase); | ||
requestContext.getRequestBase().authorize(om); |
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.
checkACLs
should be fine, it will make it very clear what is expected to take place.
requestContext.setRequestBase(requestBase); | ||
requestContext.getRequestBase().authorize(om); | ||
lockInfo = requestContext.getRequestBase().lock(omLockOpr); | ||
validate(requestContext.getRequest()); |
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.
It's ok to break up validate
into independent methods which validate only one thing
- ValidateParams
- ValidatePrepareState
- ...
There will be a long list of validations that occur in submitInternal
and that is fine.
if (om.isRatisEnabled()) { | ||
om.getOmRatisServer().getOmStateMachine().getPostExecutor().registerIndexNotifier(this::indexNotifier); | ||
} else { | ||
uniqueIndex.set(PostExecutor.initLeaderIndex(om)); |
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.
Cleaner to initialize this first.
What changes were proposed in this pull request?
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11418
How was this patch tested?