Gargi Jaiswal created HDDS-15283:
------------------------------------
Summary: GetObjectTagging should return TagSet in ordered way
Key: HDDS-15283
URL: https://issues.apache.org/jira/browse/HDDS-15283
Project: Apache Ozone
Issue Type: Sub-task
Reporter: Gargi Jaiswal
Assignee: Gargi Jaiswal
Object tags are handled internally as a {{{}Map{}}}. When {{TagSet}} is built
from map iteration (e.g. {{{}HashMap{}}}), the order of {{<Tag>}} elements in
the XML response is undefined. That order can differ from the order the client
sent on {{{}PutObjectTagging{}}}, even though keys and values are correct.
Some S3 compatibility suites (e.g. boto/s3tests) {color:#de350b}assert
{{response["TagSet"] == expected_tag_set}}{color} as Python lists, which
requires same keys, values, and order.
*Expected behavior*
{{_GetObjectTagging_}} should return tags in a stable order. Aligning with
common S3 behavior, tags should be ordered lexicographically by tag key
(Unicode/string natural order).
*Example*
{code:java}
PutObjectTagging
TagSet: [
{ Key: key, Value: val },
{ Key: key2, Value: val2 }
] {code}
{color:#de350b}Wrong (flaky / fails strict tests):{color}
{code:java}
GetObjectTagging----->
"TagSet": [
{"Key":"key2","Value":"val2"},
{"Key":"key","Value":"val"}
] {code}
*Correct (stable, passes strict equality when expectation is key-first):*
{code:java}
"TagSet": [
{"Key":"key","Value":"val"},
{"Key":"key2","Value":"val2"}
] {code}
* Emit {{TagSet}} sorted by tag key when building the {{GetObjectTagging}}
response (e.g. sort map entries before XML).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]