Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left-pad large object segment names with zeros. #319

Closed

Conversation

jbeales
Copy link
Contributor

@jbeales jbeales commented Nov 4, 2020

This fixes #318 by using a similar strategy as the official python command-line client. The segment name is left-padded with zeros so when the segment names are sorted on download they end up in the right order.

Instead of always using a length of 8 for the segment name like the command-line client, I checked the string length of the total number of segments, (which will be the name for the last segment), and added one. This way there's no client-imposed limit on the number of segments, at the expense of having to sprintf() twice.

The total length of the string is always 1 longer than the length of
the string of the total number of segments. This way the segment name
always starts with a 0 and there's no limit on the number of segments.
@jbeales
Copy link
Contributor Author

jbeales commented Nov 4, 2020

I can write a test for this. I would do it by modifying the create_large_object.php sample and updating the ObjectStore/v1/CoreTest's objects method. Do you want that added to this PR, or should it be separate?

@jbeales
Copy link
Contributor Author

jbeales commented Nov 4, 2020

I put tests here for now: https://github.com/jbeales/openstack/tree/issue-318-tests The tests currently leave behind a container of segments. If I try to delete the segment container I get a HTTP 409. Maybe because it still has segments in it, (see #286).

@k0ka
Copy link
Member

k0ka commented Dec 7, 2023

fixed in #366

@k0ka k0ka closed this Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swift Large Object Segments Sort Incorrectly
2 participants