HDDS-14665. Add upgrade handling to multipart requests#10062
HDDS-14665. Add upgrade handling to multipart requests#10062spacemonkd wants to merge 11 commits into
Conversation
ReviewThanks for landing the upgrade gate ahead of the parts-table-split write path — gating first is the right sequencing. The layout-feature wiring looks correct (no upgrade action / MLV constant needed for a behavior-only feature, and I think there's one blocker, and it's not in the gate itself — it's in the Blocker —
|
|
@kerneltime @ivandika3 it would be great if you could take a look |
errose28
left a comment
There was a problem hiding this comment.
Thanks for working on this. Not sure if you've had a chance to address the AI comments above as well.
Looks like nothing is setting schema version right now which makes it difficult to review this end to end. Can we add that to this PR?
| if (!ozoneManager.getVersionManager() | ||
| .isAllowed(OMLayoutFeature.MPU_PARTS_TABLE_SPLIT) | ||
| && multipartKeyInfo.getSchemaVersion() != 0) { | ||
| throw new OMException("MPU parts-table split behavior is not allowed " + | ||
| "before cluster finalization.", | ||
| OMException.ResultCodes.NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION); | ||
| } |
There was a problem hiding this comment.
This looks like it should be a request pre-processor like this. We will be revamping how these pre and post processors are constructed as part of ZDU but we will handle that migration on our feature branch.
There was a problem hiding this comment.
This check depends on multipartKeyInfo.getSchemaVersion() which is fetched from OM metadata for the upload row.
The validator context right now doesn't have this information exposed in PRE_PROCESS, so the pre-processor isn't implemented as you had provided in the example.
I did change it to use the layout version stamped by the leader in preExecute, so that way it will be more akin to the behaviour of a pre-processor i.e. more deterministic
| throw new IllegalArgumentException("Unsupported schemaVersion: " | ||
| + schemaVersion + ". Expected one of [0, 1]."); | ||
| } | ||
| return (byte) schemaVersion; |
There was a problem hiding this comment.
Any reason why we still keep SchemaVersion as a byte in JVM? In its proto definition schemaVersion is optional uint32 schemaVersion = 10;.
There was a problem hiding this comment.
Yes, I have reverted to int.
Initially I kept as byte since we only support the values as 0 or 1 so we do not need to allocate memory for an integer, but I guess it is easier to read with it being int.
There was a problem hiding this comment.
:-) for only 0 or 1 we can go for one bit.
| "before cluster finalization for commit part request.", | ||
| OMException.ResultCodes.NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION); | ||
| } | ||
| if (multipartKeyInfo.getSchemaVersion() == 1) { |
There was a problem hiding this comment.
Trying to learn the context:
Do we need this to be
if (ozoneManager.getVersionManager()
.isAllowed(OMLayoutFeature.MPU_PARTS_TABLE_SPLIT) &&
multipartKeyInfo.getSchemaVersion() == 1)
?
There was a problem hiding this comment.
Yes, I had missed the extra check. However I have modified this now.
Please refer to this for more context.
|
Thanks for the reviews @errose28, @kerneltime and @amaliujia.
I can add the implementation to this PR itself, but then the code changes on this would increase. Could you take another look at the new changes? CI is green. |
|
My understanding is that schema version to use will be assigned by the leader when the request is received based on whether or not the feature is finalized. Since finalization goes through ratis we would not need the request blocking parts of this change. The request processing would just follow whatever schema version it is given. I do think it would be helpful to have this whole flow in one PR, even if it increases the size. |
|
@errose28 I have added the schemaVersion wiring as well.
I have pinned the schemaVersion to 0 otherwise it was giving errors with implementation missing, but the overall helpers and checks are in place to give a better idea of the end to end flow @amaliujia could you please take a look as well? |
|
Thanks for the update @spacemonkd. We should only be checking MLV to set the schema when the request is first initiated and before it is submitted to Ratis. All subsequent requests should then use the schema version in the proto metadata as the source of truth. This can be done in a pre-processor because it only needs to mutate the incoming proto's schema version based on the current MLV, then all future processing will obey that schema version. Finalization goes through Ratis so we don't need to worry about MLV diverging between OMs. |
|
@errose28 are the latest changes now in line with what you meant? This constant |
What changes were proposed in this pull request?
HDDS-14665. Add upgrade handling to multipart requests
Please describe your PR in detail:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14665
How was this patch tested?
Patch was tested using unit tests