Chung-En Lee created HDDS-16994:
-----------------------------------
Summary: RpcClient#createKeyIfNotExists checks the wrong OM version
Key: HDDS-16994
URL: https://issues.apache.org/jira/browse/HDDS-16994
Project: Apache Ozone
Issue Type: Bug
Reporter: Chung-En Lee
`RpcClient#createKeyIfNotExists` and
`RpcClient#createStreamKeyIfNotExists}`check
`OzoneManagerVersion.ATOMIC_REWRITE_KEY` before sending a CreateKey request
with `expectedDataGeneration = EXPECTED_GEN_CREATE_IF_ABSENT` (0). The OM only
understands that value as of `ATOMIC_CREATE_IF_NOT_EXISTS` (12), added by
HDDS-13963, and `OMKeyCreateRequest#preExecute}`checks exactly that version.
An OM at versions 6–11 passes the client-side check, but it treats generation 0
as an atomic rewrite:
* If the key does not exist, the request fails with `KEY_NOT_FOUND` ("Key not
found during expected rewrite").
* If the key exists, its `updateID` is not 0, so the request fails with
`KEY_NOT_FOUND` ("Generation mismatch during expected rewrite").
No data is overwritten, but the caller gets a misleading error. For example, an
S3 PutObject with `If-None-Match: *` for a new key fails with a key-not-found
error instead of reporting that the OM does not support the operation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]