container-updater can't suppress accounts with whitespace in name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
In Progress
|
Undecided
|
Unassigned |
Bug Description
The container-updater has a unique account-suppression feature: if it cannot successfully update a quorum of account replicas, it will attempt to suppress further updates to that account for some period of time. Within a single worker handling a single part, this is easy enough. To share state between workers, though, we create a temporary files per-worker [0] which we write to as failures occur [1], and then read back in the manager process [2].
The serialization format is very simple: write out a line like "<account> <next allowed update time>". However, accounts (like all virtual paths in Swift) can contain not just spaces but newlines as well; if such an account is suppressed, it may lead to ValueErrors during unpacking or even cause us to suppress the wrong account.
[0] https:/
[1] https:/
[2] https:/
Changed in swift: | |
status: | New → In Progress |
Changed in swift: | |
assignee: | nobody → Yihong Jin (yihongjin) |
Changed in swift: | |
assignee: | Yihong Jin (yihongjin) → nobody |
I'm interested in addressing this issue as it seems like a 'good first issue' to me — its modifications won't significantly impact other components. Before beginning, I'd like to propose and discuss a few potential solutions:
1. Manual Escape Mechanism: Implement helper functions which use a backslash (\) or another special character to indicate that the subsequent character is part of the account name, not a delimiter or line break.
Pros: Intuitive.
Cons: Maintenance-heavy and may not cover all edge cases.
2. JSON Serialization: Utilize a JSON file to manage account names and their update times. JSON inherently handles special characters, eliminating the need for an explicit escape mechanism.
Pros: Automatically handles special characters, robust against edge cases, and widely used.
Cons: The codebase of SWIFT doesn't use JSON for local status storing, primarily reserving it for network-related functions. Is this caused by some special reasons?
I look forward to discussing these options and identifying the best approach. Additionally, I'd like to make sure if there are other modules that depend on this file, as this could influence our choice of solution.
UPDATE:
Finally decided to go with URL Encoding provided by urllib as it will be a quick and robust solution. Have committed the change.