Siyao Meng created HDDS-16757:
---------------------------------
Summary: RenameKeys overwrites an existing destination key and
still reports the pair as not renamed
Key: HDDS-16757
URL: https://issues.apache.org/jira/browse/HDDS-16757
Project: Apache Ozone
Issue Type: Bug
Components: Ozone Manager
Reporter: Siyao Meng
Assignee: Siyao Meng
In {{OMKeysRenameRequest#validateAndUpdateCache}}, the "Check if toKey exists"
block marks the pair as not renamed (adds it to {{unRenamedKeys}} and sets the
status to false) but does not {{continue}} to the next pair, unlike the other
checks in the same loop. The rename then goes ahead.
Effects of a batch rename where the destination key already exists:
* The source key replaces the destination key in the key table. The blocks of
the old destination key are never added to the deleted table, so they are
leaked.
* The response is {{PARTIAL_RENAME}} and lists the same pair in
{{unRenamedKeys}}, so the client is told that the rename did not happen.
* If the source key does not exist either, the pair is listed twice in
{{unRenamedKeys}}.
The single key rename ({{OMKeyRenameRequest}}) rejects this case with
{{KEY_ALREADY_EXISTS}}.
Steps to reproduce:
# Create {{key1}} and {{key2}} in the same bucket.
# Call {{OzoneBucket#renameKeys}} with {{key1}} mapped to {{key2}}.
# The call fails with {{PARTIAL_RENAME}}, but {{key1}} is gone and {{key2}} now
has the content of {{key1}}.
Expected: the pair is skipped, and both keys are left unchanged.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]