HDDS-14665. Add upgrade handling to multipart requests#10062
HDDS-14665. Add upgrade handling to multipart requests#10062spacemonkd wants to merge 12 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?
| 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.
|
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 |
|
@errose28 could you take a look as well? |
There was a problem hiding this comment.
Thanks for the updates. This method of choosing schema version works. I'm reworking the pre-process validators on the ZDU branch but this implementation will be easy to move. Mostly minor comments but the patch does have one blocking issue noted here.
|
|
||
| private static final Logger LOG = | ||
| LoggerFactory.getLogger(S3InitiateMultipartUploadRequest.class); | ||
| private static final int LEGACY_MPU_SCHEMA_VERSION = 0; |
There was a problem hiding this comment.
Can we define the schema versions in one place as public constants? Right now definitions are duplicated between this class and OmMultipartKeyInfo.
There was a problem hiding this comment.
Addressed in the latest commit
| // write/read paths are fully implemented. | ||
| return req.toBuilder() | ||
| .setInitiateMultiPartUploadRequest(initiateRequest.toBuilder() | ||
| .setSchemaVersion(LEGACY_MPU_SCHEMA_VERSION)) |
There was a problem hiding this comment.
I may have missed this in an earlier comment, but this change has no effect if we commit it with the new layout version but a no-op action attached to that. Say a release goes out with this PR as is. The new MPU version will get finalized, but nothing changes. In the next release we would then need to add a second MPU layout version to check because the first one was basically wasted. The HBase feature made this mistake while trying to develop on master, that's why there's a "deprecated" HBase layout feature and the actual one comes later.
So if we merge this in its current state the master branch is unreleasable. We either need to hold off on this change and leave the new schema hardcoded to off until it is ready for release, or decide that work is complete and flip the switch to enable it for finalized clusters in this PR.
There was a problem hiding this comment.
Hmm, I raised #10588 to implement the split table writes.
Maybe we can merge this PR after that to avoid this situation?
Could you take a look at that PR then, when you get the time?
| } | ||
|
|
||
| @Test | ||
| public void testValidateAndUpdateCacheUsesSchemaVersionOneBeforeFinalization() |
There was a problem hiding this comment.
It's somewhat unintuitive how the parent class sets the version manager to pre-finalized by default and tests need to opt in to finalize it. If it's too much change to reverse that in this PR, let's at least add a comment about it on these tests.
There was a problem hiding this comment.
Addressed in latest commit
|
|
||
| // Add key to open key table. | ||
| addKeyToOpenKeyTable(volumeName, bucketName, keyName, clientID); | ||
| String openKey = getOpenKey(volumeName, bucketName, keyName, clientID); |
There was a problem hiding this comment.
Why were these last parts after the new test added? They don't seem directly related to the feature.
There was a problem hiding this comment.
Addressed in latest commit
| } | ||
|
|
||
| @Test | ||
| public void testValidateAndUpdateCacheDirectoryNotFound() throws Exception { |
There was a problem hiding this comment.
Is this test related to the MPU version somehow?
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