22605d21ee9c5cb25ad2f3b2f321c8593aefcbdf
Commit Graph

6299 Commits

Author SHA1 Message Date
Zuul
9a45531942 Merge "Test each method in test_crossdomain_get_only" 2025年10月01日 18:39:37 +00:00
Shashirekha Gundur
a6bde729c5 Test each method in test_crossdomain_get_only
iterate through not allowed methods and assert
Change-Id: Ia304709fc56d3e81bb1326b56a4b0d64ed698160
Signed-off-by: Tim Burke <tim.burke@gmail.com>
2025年10月01日 09:22:20 -07:00
Zuul
6da1207489 Merge "test: move import to top of file" 2025年10月01日 15:52:58 +00:00
Clay Gerrard
64bb041398 Assert metadata of SLO PUT from container sync
In addition to being in the pure unmolested ondisk format from the
source container; the manifest must also include the normally
protected X-Static-Large-Object metadata.
Change-Id: Ic6638e8258e9dec755f8d9630f0586bd3c9b4420
Related-Change: I8d503419b7996721a671ed6b2795224775a7d8c6
Signed-off-by: Tim Burke <tim.burke@gmail.com>
2025年10月01日 08:41:40 -07:00
Zuul
a9a1ea4137 Merge "Adds --skip-commits to s-m-s-r" 2025年09月30日 18:33:41 +00:00
Clay Gerrard
b55f13c758 test: move import to top of file
Related-Change-Id: I38c11b7aae8c4112bb3d671fa96012ab0c44d5a2
Change-Id: Ibe5d206d2b96e174f849715fb13562ae0d2f5de2
Signed-off-by: Clay Gerrard <clay.gerrard@gmail.com>
2025年09月30日 12:40:16 -05:00
Zuul
e5d44d669a Merge "proxy: use cooperative tokens to coalesce updating shard range requests into backend" 2025年09月30日 17:06:54 +00:00
Christian Ohanaja
ba1ab9d11c Adds --skip-commits to s-m-s-r
This patch replaces --force-commits with a --skip-commits flag in
swift-manage-shard-ranges to determine when to commit object updates.
Change-Id: I6de041f5c12dca2618d22d1271efe242b2f35258
Signed-off-by: Christian Ohanaja <cohanaja@nvidia.com>
2025年09月30日 16:25:17 +00:00
Jianjian Huo
d9883d0834 proxy: use cooperative tokens to coalesce updating shard range requests into backend
The cost of memcache misses could be deadly. For example, when
updating shard range cache query miss, PUT requests would have to
query the backend to figure out which shard to upload the objects.
And when a lot of requests are sending to the backend at the same
time, this could easily overload the root containers and cause a
lot of 500/503 errors; and when proxy-servers receive responses of
all those 200 backend shard range queries, they could in turn try
to write the same shard range data into memcached servers at the
same time, and cause memcached to return OOM failures too.
We have seen cache misses frequently to updating shard range cache
in production, due to Memcached out-of-memory and cache evictions.
To cope with those kind of situations, a memcached based cooperative
token mechanism can be added into proxy-server to coalesce lots of
in-flight backend requests into a few: when updating shard range
cache misses, only the first few of requests will get global
cooperative tokens and then be able to fetch updating shard ranges
from backend container servers. And the following cache miss
requests will wait for cache filling to finish, instead of all
querying the backend container servers. This will prevent a flood
of backend requests to overload both container servers and memcached
servers.
Drive-by fix: when memcache is not available, object controller will
only need to retrieve a specific shard range from the container server
to send the update request to.
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Co-Authored-By: Yan Xiao <yanxiao@nvidia.com>
Co-Authored-By: Shreeya Deshpande <shreeyad@nvidia.com>
Signed-off-by: Jianjian Huo <jhuo@nvidia.com>
Change-Id: I38c11b7aae8c4112bb3d671fa96012ab0c44d5a2
2025年09月29日 19:44:50 -07:00
Zuul
dd23020c30 Merge "common: add memcached based cooperative token mechanism." 2025年09月29日 22:59:08 +00:00
ashnair
d353f15fac account-broker: add resilient path property with lazy cache
Add a path property for AccountBroker and use lazy, resilient
_populate_instance_cache(). Use None attrs as flags, avoid broad
try/except in path, and retry if cache population fails.
Change-Id: Ic7c2aa878caf039b29abb900b4f491130be3d8a8
Signed-off-by: ashnair <ashnair@nvidia.com>
2025年09月29日 15:42:11 +00:00
Jianjian Huo
707a65ab3c common: add memcached based cooperative token mechanism.
Memcached based cooperative token is a improved version of ghetto lock,
see the description of ghetto lock at here:
https://github.com/memcached/memcached/wiki/ProgrammingTricks
It's used to avoid the thundering herd situation which many caching
users face: given a cache item that is popular and difficult to
recreate, in the event of cache misses, users could end up with hundreds
(or thousands) of processes slamming the backend database at the same
time in an attempt to refill the same cache content. This thundering
herd problem not only often leads to unresponsive backend; and also
those writes into memcached cause premature cache eviction under memory
pressure.
With cooperative token, when lots of in-flight callers try to get the
cached item specified by key from memcache and get cache misses, only
the first few query requests (limited by by ``num_tokens``) will be able
get the cooperative tokens by creating or incrementing an internal
memcache key, and then those callers with tokens can send backend
requests to fetch data from backend servers and be able to set data into
memcache; all other cache miss requests without a token should wait for
cache filling to finish, instead of all querying the backend servers at
the same time.
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Co-Authored-By: Yan Xiao <yanxiao@nvidia.com>
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Signed-off-by: Jianjian Huo <jhuo@nvidia.com>
Change-Id: I50ff92441c2f2c49b3034644aba59930e8a99589
2025年09月26日 11:28:40 -07:00
Zuul
92dd03ed77 Merge "diskfile: Fix UnboundLocalError during part power increase" 2025年09月16日 17:25:57 +00:00
Clay Gerrard
7b05356bd0 test: do not create timestamp collision unnecessarily
Change-Id: Ib6bf702e38495e52e3b2f5ca95ed17c519018474
Signed-off-by: Clay Gerrard <clay.gerrard@gmail.com>
2025年09月16日 09:52:18 -05:00
Clay Gerrard
815393dff4 test: fix module state pollution
The disable_fallocate function provided in common.utils doesn't really
have a way to undo it - it's tested independently in test_utils.
It shouldn't be used on test_diskfile or else test_utils fallocate tests
will fail afterwards.
Change-Id: I6ffa97b39111ba25f85ba7cfde21440d975dc760
Signed-off-by: Clay Gerrard <clay.gerrard@gmail.com>
2025年09月16日 09:50:31 -05:00
Alistair Coles
c26c7b8edd tests: simplify TestGlobalSetupObjectReconstructor setUp
Change-Id: I0168ab113fdda60ed858ed0928356699399d4044
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年09月16日 14:42:56 +01:00
Tim Burke
397f94c73b diskfile: Fix UnboundLocalError during part power increase
Closes-Bug: #2122543
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: I8a2a96394734899ee48e1d9264bf3908968c51a8
2025年09月10日 13:27:25 -07:00
Clay Gerrard
b5e6964a22 s3api: fix test_service with pre-existing buckets
The s3api cross-compat tests in test_service weren't sophisticated
enough to account for real s3 session credentials that could see actual
aws s3 buckets (or a vsaio you actually use) - however valid assertions
on the authorization logic doesn't actually require such a strictly
clean slate.
Drive-by: prefer test config option without double negative, and update
ansible that's based on the sample config.
Related-Change-Id: I811642fccd916bd9ef71846a8108d50a462740f0
Change-Id: Ifab08cfe72f12d80e2196ad9b9b7876ace5825b4
Signed-off-by: Clay Gerrard <clay.gerrard@gmail.com>
2025年09月03日 11:57:19 -05:00
Tim Burke
e13f4abcd7 tests: Skip some tests if crc32c is not available
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: I2e2a4e2c448319e6531372ae06ab81eb58edc57e
2025年08月29日 11:16:04 -07:00
Zuul
e10c2bafcb Merge "proxy-logging: create field for access_user_id" 2025年08月26日 03:43:46 +00:00
Vitaly Bordyug
32eaab20b1 proxy-logging: create field for access_user_id
Added the new field to be able to log the access key during the
s3api calls, while reserving the field to be filled with auth relevant
information in case of other middlewares. Added respective code to
the tempauth and keystone middlewares.
Since s3api creates a copy of the environ dict for the downstream
request object when translating the s3req.to_swift_req the environ
dict that is seen/modifed in other mw module is not the same instance
seen in proxy-logging - using mutable objects get transfered into the
swift_req.environ.
Change the assert in test_proxy_logging from "the last field" to
the index 21 in the interests of maintainability.
Also added some regression tests for object, bucket and s3 v4 apis and
updated the documentation with the details about the new field.
Signed-off-by: Vitaly Bordyug <vbordug@gmail.com>
Change-Id: I0ce4e92458e2b05a4848cc7675604c1aa2b64d64
2025年08月26日 01:14:37 +00:00
Zuul
457af40c9b Merge "s3api compat tests: stop asserting DisplayName in Owner" 2025年08月22日 15:51:48 +00:00
Alistair Coles
c4cc83c5e7 s3api compat tests: stop asserting DisplayName in Owner
S3 stopped returning DisplayNamme in the Owner field of object
listings [1], so the tests need to stop asserting that it is present.
Further work is needed to drop DisplayName from the Swift s3api
responses [2].
[1] https://docs.aws.amazon.com/AmazonS3/latest/API/API_Owner.html
[2] https://bugs.launchpad.net/swift/+bug/2120622
Change-Id: Ia915a65313394910c74ae826c912b5549e833a7b
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年08月22日 14:42:34 +01:00
Tim Burke
81df05a9c4 checksums: Ignore broken pyeclib installs
The RuntimeError gives more of a hint than the TypeError, but we haven't
really solved the issue. If there's a busted pyeclib install, it's safe
to assume it won't have ISA-L alongside it; just proceed assuming it's
not available.
Closes-Bug: #2120591
Related-Change: I64a85eb739fb72efe41f1ee829e463167246b793
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: I2791566b208327b1fb536fb56a363337ab3f3941
2025年08月21日 08:42:05 -07:00
Zuul
c1d34baa78 Merge "Timestamp: fix inconsistent raw and normal values" 2025年08月15日 18:45:52 +00:00
Zuul
fa3a75b73d Merge "checksum.py: fail gracefully if pyeclib is broken" 2025年08月15日 14:44:44 +00:00
Alistair Coles
5b2e4e00c1 ssync unit test: fix intermittent failure
ssync unit tests would sometimes fail when making assertions about the
ssync receiver log messages. Test runner output would show that the
messages were eventually being logged. However, the assertions could
be made before the ssync receiver request thread had completed.
A trampoline had been previously been used to workaround this, but
that is clearly insufficient. The author found that increasing the
trampoline interval would help reduce the rate of failures, but not
eliminate them.
This patch introduces a custom GreenPool for the unit test wsgi object
server so that tests can deterministically wait for the receiver
request handling thread to exit before making assertions.
Closes-Bug: #212065
Change-Id: I09ad8bb1becae46a78902d1d384a9f27a3d54b38
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年08月14日 15:33:50 +01:00
Alistair Coles
74274ec8bc checksum.py: fail gracefully if pyeclib is broken
If pyeclib dist is missing files then the isal loading would blow up
with "TypeError: 'NoneType' object is not iterable". This patch
changes that to a RuntimeError with a more useful message.
Change-Id: I64a85eb739fb72efe41f1ee829e463167246b793
Closes-Bug: #2120591
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年08月14日 11:14:41 +01:00
Alistair Coles
93b88540dc Timestamp: fix inconsistent raw and normal values
Previously it was possible for a Timestamp to have inconsistent raw
and normal values. For example:
>>> ts1 = Timestamp(1755077566.523385)
>>> (ts1.normal, ts1.raw, (~ts1).normal)
('1755077566.52339', 175507756652338, '8244922433.47661')
This results in the invert function not being reliably reversible:
(~(~ts1)).normal
'1755077566.52338'
The cause is that the normal value is based on Timestamp.timestamp
which preserves the precision of the value given to the constructor,
whereas the invert function uses the limited precision raw value.
This patch forces Timestamp.timestamp to have the limited precision
value of Timestamp.raw.
Change-Id: I4e7fd6078aae3f284628303f20ced66aa702c466
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年08月13日 13:39:29 +01:00
Zuul
bdb052b59b Merge "ssync-receiver: terminate session if subreq read times out" 2025年08月11日 19:06:40 +00:00
Zuul
044ba6c40f Merge "Ring v2 follow-up" 2025年08月08日 04:34:42 +00:00
Tim Burke
683218c523 Ring v2 follow-up
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: I75bd005a4a3bc79c1bd8f8fa1153a64059970865
2025年08月07日 18:54:11 -07:00
Zuul
c8d00108a6 Merge "Fix another way mw may encouter invalid swift paths" 2025年08月07日 00:06:31 +00:00
Zuul
d535833b0b Merge "crypto: Fix traceback on non-utf8, non-swift paths" 2025年08月06日 21:10:22 +00:00
Clay Gerrard
a770881b59 Fix another way mw may encouter invalid swift paths
Related-Change-Id: I8c342c4751ba3ca682efd152e90e396e9f8eb851
Change-Id: I9df32c5aae4e681d488419f36982ffc36589d50a
Signed-off-by: Clay Gerrard <clay.gerrard@gmail.com>
2025年08月06日 14:53:43 -05:00
Zuul
ee432f03ac Merge "ring: Introduce a v2 ring format" 2025年08月05日 07:44:41 +00:00
Tim Burke
1dc3307eaf ssync-receiver: terminate session if subreq read times out
If a PUT subrequest body iterator times out while the object server is
reading it, the object server will handle the timeout and return a 500
response to the ssync receiver.
Previously, the ssync receiver would attempt to drain the remainder of
the subrequest body iterator and then resume reading the next
subrequest from the SSYNC body. However, the attempt to drain the
subrequest iterator would fail (silently) because the timeout had
already caused the iterator to exit.
The ssync receiver would therefore treat any remaining subrequest body
as the preamble to the next subrequest. This remaining subrequest body
content was likely to cause the protocol parsing to fail, but in the
worst case could be erroneously interpreted as a valid subrequest.
(The exact failure mechanism depends on what state the
eventlet.wsgi.Input is left in when the timeout fired.)
This patch ensures that the ssync receiver will terminate processing
an SSYNC request if an exception occurs while reading a subrequest
body.
Closes-Bug: #2115991
Change-Id: I585e8a916d947c3da8d7c0e8a85cf0a8ab85f7f0
Co-authored-by: Tim Burke <tim.burke@gmail.com>
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年08月04日 15:01:30 +01:00
Tim Burke
86a1acc9e3 crypto: Fix traceback on non-utf8, non-swift paths
fetch_crypto_keys can fail like
get_keys(): from callback: 'utf-8' codec can't encode character '\udcc0' in position 1: surrogates not allowed:
Traceback (most recent call last):
 File ".../swift/common/middleware/crypto/crypto_utils.py", line 166, in get_keys
 keys = fetch_crypto_keys(key_id=key_id)
 File ".../swift/common/middleware/crypto/keymaster.py", line 148, in fetch_crypto_keys
 keys['container'] = self.keymaster.create_key(
 File ".../swift/common/middleware/crypto/keymaster.py", line 322, in create_key
 path = path.encode('utf-8')
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc0' in position 1: surrogates not allowed
This doesn't fix *all* non-utf8 paths, but
- it was easy enough to avoid the non-swift ones, which have been seen
 in prod, and
- there's ample precedent in other middlewares for checking API version.
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: I8c342c4751ba3ca682efd152e90e396e9f8eb851
2025年07月31日 14:52:53 -07:00
Zuul
f39133055f Merge "sharder: make gap and overlap warning logs shorter" 2025年07月28日 21:53:26 +00:00
Zuul
2e8338240f Merge "Fix recursion error in account_quota middleware" 2025年07月25日 16:23:14 +00:00
Christian Schwede
06a6329793 Fix recursion error in account_quota middleware
There is an infinite loop if multiple quota limits are set and exceeded,
eventually resulting in a 500 response due to a RecursionError ("maximum
recursion depth exceeded").
The issue is the delayed rejection, required to support container_acls.
If any quota is exceeded the middleware needs to return directly,
without proceeding to check other quota settings.
The fix is basically to add a "return self.app". However, there is quite
some redundant code, thus moving this into its own method.
Another test with multiple exceeded quotas has been added, which is
failing without the bugfix.
Closes-Bug: #2118758
Change-Id: I49ec4c5f6c83f36ce1d38f2f1687081c71488286
Signed-off-by: Christian Schwede <cschwede@redhat.com>
2025年07月25日 09:12:41 +00:00
Alistair Coles
fd342b9190 sharder: make gap and overlap warning logs shorter
Previously, when the audit process detected gaps and/or overlaps in a
DB's shard ranges, it would log a warning that included a list of all
impacted shard ranges. The log message can grow long when there are
gaps or overlaps involving many shard ranges: so long that syslog
might raise an OSError (Message too long).
This patch shortens these log warning messages to only include a count
of the number of gaps and/or overlaps. The count may still be useful
to observe how a problem has developed over time. The detailed
information is better accessed using the swift-manage-shard-ranges
repair command.
Change-Id: I055c40395807708de60882f53652d9533a495d09
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年07月23日 15:01:14 +01:00
Tim Burke
ae062f8b09 ring: Introduce a v2 ring format
There's a bunch of moving pieces here:
- Add a new RingWriter class.
 Stick it in a new swift.common.ring.io module. You *can* use it like
 the old gzip file, but you can also define named sections which can
 be referenced later on read. Section names may be arbitrary strings,
 but the "swift/" prefix is reserved for upstream use. Sections must
 contain a single length-value encoded BLOB. If sections are used, an
 additional BLOB is written at the end containing a JSON section-index,
 followed by an uncompressed offset for the index.
 Move RingReader to ring/io.py, too.
- Clean up some ring metadata handling:
 - Drop MD5 tracking in RingReader. It was brittle at best anyway, and
 nothing uses it. YAGNI
 - Fix size/raw_size attributes when loading only metadata.
- Add the ability to seek within RingReaders, though you need to know
 what you're doing and only seek to flush points.
- Let RingBuilder objects change how wide their replica2part2dev_id
 arrays are. Add a dev_id_bytes key to serialized ring metadata.
 dev_id_bytes may be either 2 or 4, but 4 requires v2 rings. We
 considered allowing dev_id_bytes of 1, but dropped it as unnecessary
 complexity for a niche use case.
- swift-ring-builder version subcommand added, which takes a ring. This
 lets operators see the serialization format of a ring on disk:
 $ swift-ring-builder object.ring.gz version
 object.ring.gz: Serialization version: 2 (2-byte IDs), build version: 54
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: Ia0ac4ea2006d8965d7fdb6659d355c77386adb70
2025年07月21日 11:37:15 -07:00
Zuul
e75e93f11c Merge "Drop support for old pickled rings" 2025年07月21日 09:23:35 +00:00
Tim Burke
0417979ca5 Drop support for old pickled rings
We stopped writing pickled rings more than twelve years ago. Any
cluster that was going to upgrade from then has, or can pick any of
the multitude of intermediary releases to pause at and push rings.
We can also safely assume that regions will be present for devices;
that change is nearly as old.
As a side-effect, clean up some old tests that did nonsense things
like having 7 assignments per row for a part-power-2 ring.
UpgradeImpact: remove ability to read rings written by swift <1.7.0
circa 2012
Related-Change: I799b9a4c894d54fb16592443904ac055b2638e2d
Related-Change: Ifefbb839cdcf033e6c9201fadca95224c7303a29
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: Ic8322b18d51b40f586cb217a0d1b2f345e1d8df6
2025年07月18日 18:29:20 +00:00
Zuul
8af485775a Merge "s3api: Add support for crc64nvme checksum calculation" 2025年07月18日 04:32:37 +00:00
Zuul
a1f7a1e82d Merge "s3api: add more assertions w.r.t. S3 checksum BadDigest" 2025年07月16日 17:32:52 +00:00
Alistair Coles
404e1f2732 s3api: Add support for crc64nvme checksum calculation
Add anycrc as a soft dependency in case ISA-L isn't available.
Plus we'll want it later: when we start writing down checksums,
we'll need it to combine per-part checksums for MPUs.
Like with crc32c, we won't provide any pure-python version as the
CPU-intensiveness could present a DoS vector. Worst case, we 501
as before.
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Signed-off-by: Tim Burke <tim.burke@gmail.com>
Change-Id: Ia05e5677a8ca89a62b142078abfb7371b1badd3f
Signed-off-by: Alistair Coles <alistairncoles@gmail.com>
2025年07月16日 17:51:31 +01:00
Zuul
d9115f24d6 Merge "s3api: add compat test sending too much body with checksum" 2025年07月16日 16:24:08 +00:00
Zuul
2fc9209d47 Merge "s3api: Validate additional checksums on upload" 2025年07月15日 18:48:52 +00:00