4764 Commits

Author SHA1 Message Date
Zuul
cd40cb3e98 Merge "Allow bulk to fwd some headers at tar extraction" 2020-01-23 11:03:19 +00:00
Zuul
d3916312d3 Merge "More multi-char-delimiter func test coverage" 2020-01-22 22:50:04 +00:00
Clay Gerrard
2be4716bc9 More multi-char-delimiter func test coverage
Change-Id: I4cad872ef97313ec19a8e4ef042696565a56d4c5
2020-01-22 12:37:21 -08:00
Tim Burke
55cdb55075 Lower the log level for falling back to mkstemp
We recently started trying to use O_TMPFILE without the kernel version
check, we gracefully degrade when it isn't available, and we don't give
operators any way to avoid the O_TMPFILE attempt -- logging at warning
seems way too noisy.

Change-Id: I8f42127fd6eb930282161930c65e8614f3e3175f
Related-Change: I3599e2ab257bcd99467aee83b747939afac639d8
2020-01-22 11:00:18 -08:00
gillesbiannic
f68e22d43a Stop retrying every deletes in container-sync
Internal clients used to retry operations even on client errors, where
we had no expectation that we would get a different response. Among
other things, this would cause container-sync to needlessly retry
deletes that would 404, even though we had code specifically in place to
say that 404s are OK.

While we're at it, also flag 409s as being OK (since the remote has
newer data than us).

Change-Id: I1833a8ff2ac2f4126b6274d6bba47e2b58a41745
Closes-Bug: #1849841
2020-01-20 22:06:44 -08:00
Tim Burke
73a0e8e9cf probe: Add test for syncing a delete when the remote 404s
This works fine; we continue processing the other rows in the DB. But it
*does* take longer than it really ought to require. See the related bug;
we ought to be able to shave some 17s off the test time by not retrying
on the 404.

Change-Id: I9ca2511651e9b2bc0045894baa4062d20bc15369
Related-Bug: #1849841
2020-01-20 22:06:43 -08:00
Zuul
b7c1f8d149 Merge "py3: Fix formpost unicode filename issues" 2020-01-21 05:21:14 +00:00
Zuul
68924d920c Merge "Have slo tell the object-server that it wants whole manifests" 2020-01-18 13:31:32 +00:00
Tim Burke
7bba3ad04d Store normalized x-delete-at on PUT/POST
Change-Id: I81e5d49623e884def8b5f6cbbf82f9b0d667d64a
Closes-Bug: 1860149
2020-01-18 02:52:31 +00:00
Romain LE DISEZ
ff0753fe19 Allow bulk to fwd some headers at tar extraction
Whitelisted headers include X-Delete-At/X-Delete-After and all Object
metadata headers (X-Object-Meta-*)

Closes-Bug: 1857546
Change-Id: If5fb164693e395f89d57899fb8ab355f1e3f817c
2020-01-17 11:34:39 -08:00
Tim Burke
57ca3570e9 Allow Timestamp comparisons against out-of-range values
Prior to the related change, clients may have written down X-Delete-At headers
that are outside of the Timestamp range, for example.

Change-Id: Ib8ae7ebcbdb32e0aa58446bd1ef949e5e2f63e74
Related-Change: I23666ec8a067d829eaf9bfe54bd086c320b3429e
Related-Bug: 1821204
Partial-Bug: 1860149
2020-01-17 08:11:34 -08:00
Zuul
e92288bb61 Merge "account-server: Add test for leading delimiter" 2020-01-17 01:38:06 +00:00
Zuul
7eccca9344 Merge "Early-return on non-Swift get_info requests" 2020-01-17 00:06:14 +00:00
Tim Burke
9483630ae1 py3: Fix formpost unicode filename issues
Previously, we took the native string filename attribute and put it
directly in the (WSGI string) PATH_INFO field. Now, we convert it to
a WSGI string first.

Change-Id: I30e3beb8707b88c36bd3cdc7a0887d069e943ba6
Closes-Bug: #1858259
2020-01-15 16:52:37 -08:00
Sean McGinnis
5b26b749b5
Drop use of unittest2
unittest2 was needed for Python version <= 2.6, so it hasn't been needed
for quite some time. See unittest2 note one:

https://docs.python.org/2.7/library/unittest.html

This drops unittest2 in favor of the standard unittest module.

Change-Id: I2e787cfbf1709b7f9c889230a10c03689e032957
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-01-12 03:13:41 -06:00
Zuul
a4f1078864 Merge "Allow reconciler to handle reserved names" 2020-01-07 03:01:36 +00:00
Zuul
e23a3eacb6 Merge "Make FakeSwift query param order agnostic" 2020-01-07 01:30:33 +00:00
Zuul
e32689a96d Merge "Deprecate per-service auto_create_account_prefix" 2020-01-07 01:30:20 +00:00
Clay Gerrard
6140190791 Make FakeSwift query param order agnostic
Apparently FakeSwift has always been persnickety about the order of
query params of registered responses and the app making the calls.
Since query params can often be converted to dictionaries the order of
the encoded params should be able to change without effecting the apps
dispatching of registered responses.

Change-Id: Ied68c9334201a7663e9c85f3bdaa5b0643d4b6db
2020-01-06 16:27:06 -06:00
Zuul
fb538a9afe Merge "sharding: Better-handle newlines in container names" 2020-01-05 20:02:30 +00:00
Clay Gerrard
b1178b4a96 Allow reconciler to handle reserved names
Change-Id: Ib918f10e95970b9f562b88e923c25608b826b83f
2020-01-05 10:04:05 -06:00
Clay Gerrard
4601548dab Deprecate per-service auto_create_account_prefix
If we move it to constraints it's more globally accessible in our code,
but more importantly it's more obvious to ops that everything breaks if
you try to mis-configure different values per-service.

Change-Id: Ib8f7d08bc48da12be5671abe91a17ae2b49ecfee
2020-01-05 09:53:30 -06:00
Tim Burke
3f88907012 sharding: Better-handle newlines in container names
Previously, if you were on Python 2.7.10+ [0], such a newline would cause the
sharder to fail, complaining about invalid header values when trying to create
the shard containers. On older versions of Python, it would most likely cause a
parsing error in the container-server that was trying to handle the PUT.

Now, quote all places that we pass around container paths. This includes:

  * The X-Container-Sysmeta-Shard-(Quoted-)Root sent when creating the (empty)
    remote shards
  * The X-Container-Sysmeta-Shard-(Quoted-)Root included when initializing the
    local handoff for cleaving
  * The X-Backend-(Quoted-)Container-Path the proxy sends to the object-server
    for container updates
  * The Location header the container-server sends to the object-updater

Note that a new header was required in requests so that servers would
know whether the value should be unquoted or not. We can get away with
reusing Location in responses by having clients opt-in to quoting with
a new X-Backend-Accept-Quoted-Location header.

During a rolling upgrade,

  * old object-servers servicing requests from new proxy-servers will
    not know about the container path override and so will try to update
    the root container,
  * in general, object updates are more likely to land in the root
    container; the sharder will deal with them as misplaced objects, and
  * shard containers created by new code on servers running old code
    will think they are root containers until the server is running new
    code, too; during this time they'll fail the sharder audit and report
    stats to their account, but both of these should get cleared up upon
    upgrade.

Drive-by: fix a "conainer_name" typo that prevented us from testing that
we can shard a container with unicode in its name. Also, add more UTF8
probe tests.

[0] See https://bugs.python.org/issue22928

Change-Id: Ie08f36e31a448a547468dd85911c3a3bc30e89f1
Closes-Bug: 1856894
2020-01-03 16:04:57 -08:00
Zuul
f73a190837 Merge "Use less responses from handoffs" 2020-01-03 03:13:58 +00:00
Clay Gerrard
286082222d Use less responses from handoffs
Since we don't use 404s from handoffs anymore, we need to not let errors
on handoffs overwhelm primary responses either

Change-Id: I2624e113c9d945542f787e5f18f487bd7be3d32e
Closes-Bug: #1857909
2020-01-02 16:44:05 -08:00
Tim Burke
55ab08a5fa account-server: Add test for leading delimiter
Related-Change: I27701a31bfa22842c272b7781738e8c546b82cbc
Related-Change: If912f71d8b0d03369680374e8233da85d8d38f85
Change-Id: I0c850b8ae40d1ab477d0f5d18f92579c457da54e
Related-Bug: 1475018
2020-01-02 16:26:18 -08:00
Tim Burke
e8b654f318 Have slo tell the object-server that it wants whole manifests
Otherwise, we waste a request on some 416/206 response that won't be
helpful.

To do this, add a new X-Backend-Ignore-Range-If-Metadata-Present header
whose value is a comma-separated list of header names. Middlewares may
include this header to tell object-servers to send the whole object
(rather than a 206 or 416) if *any* of the metadata are present.

Have dlo and symlink use it, too; it won't save us any round-trips, but
it should clean up some object-server logging.

Change-Id: I4ff2a178d0456e7e37d561109ef57dd0d92cbd4e
2020-01-02 15:48:39 -08:00
Tim Burke
d246bf20ed sharding: Tolerate blank limits when listing
Otherwise, we can 500 with

   ValueError: invalid literal for int() with base 10: ''

Change-Id: I35614aa4b42e61d97929579dcb16f7dfc9fef96f
2019-12-19 22:27:27 -08:00
Zuul
e890b0f0fc Merge "WSGI server workers must drop_privledges" 2019-12-16 18:48:43 +00:00
Tim Burke
1f7b97ec0f Add normalize_etag() helper function
... and drive-by a import rename

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I1eaf075ff9855cfa03e7991bdf33375b0e4397e6
2019-12-14 01:53:43 +00:00
Tim Burke
b65d8b10c5 Early-return on non-Swift get_info requests
Change-Id: Iadc61a1c3bcbfbc47f65ec65df36d8da3694ee74
2019-12-14 01:38:31 +00:00
Clay Gerrard
6b33cf99f4 WSGI server workers must drop_privledges
... just like they always have and server per port strategy still does.

Related-Change-Id: I3e5229d2fb04be67e53533ff65b0870038accbb7
Change-Id: I14e3ed201ceaceef0f8dbc44685395f350a0e7fc
2019-12-12 17:02:51 -06:00
Tim Burke
8c0fd3f138 py3: Make seamless reloads work
Starting with Python 3.4, newly-created file descriptors are non-inheritable
[0], which causes trouble when we try to use a pipe for IPC. Fortunately, the
same PEP that implemented this change *also* provided a new API to mark file
descriptors as being inheritable -- so just do that.

While we're at it,

* Fix up the probe tests to work on py3
* Fix up the probe tests to work when policy-0 is erasure-coded
* Decode the bytes read so py3 doesn't log a b'pid'
* Log a warning if the read() is empty; something surely went wrong
  in the re-exec

[0] https://www.python.org/dev/peps/pep-0446/

Change-Id: I2a8a9f3dc78abb99bf9cbcf6b44c32ca644bb07b
Related-Change: I3e5229d2fb04be67e53533ff65b0870038accbb7
2019-12-11 01:07:19 +00:00
Tim Burke
da4e07164e Set swift_source more in s3api middleware
Change-Id: I89f3a4b5a3a8c160afb298aad726acce09c65265
2019-12-06 08:32:48 -08:00
Clay Gerrard
698717d886 Allow internal clients to use reserved namespace
Reserve the namespace starting with the NULL byte for internal
use-cases.  Backend services will allow path names to include the NULL
byte in urls and validate names in the reserved namespace.  Database
services will filter all names starting with the NULL byte from
responses unless the request includes the header:

    X-Backend-Allow-Reserved-Names: true

The proxy server will not allow path names to include the NULL byte in
urls unless a middlware has set the X-Backend-Allow-Reserved-Names
header.  Middlewares can use the reserved namespace to create objects
and containers that can not be directly manipulated by clients.  Any
objects and bytes created in the reserved namespace will be aggregated
to the user's account totals.

When deploying internal proxys developers and operators may configure
the gatekeeper middleware to translate the X-Allow-Reserved-Names header
to the Backend header so they can manipulate the reserved namespace
directly through the normal API.

UpgradeImpact: it's not safe to rollback from this change

Change-Id: If912f71d8b0d03369680374e8233da85d8d38f85
2019-11-27 11:22:00 -06:00
Clay Gerrard
a2aaf59852 Fix BadResponseLength error when creating symlink
Closes-Bug: #1854074

Change-Id: I587275e68083aaed3c04486049b67791b52562b7
2019-11-27 11:21:36 -06:00
Tim Burke
b5c9dc1c9f py3: Fix s3api header casing
Closes-Bug: #1853367

Change-Id: Ifb15ce50fc3bcfda9532a2c3dec542c272ea4933
2019-11-20 12:14:35 -08:00
Zuul
9fa0b211a9 Merge "Seamlessly reload servers with SIGUSR1" 2019-11-14 20:34:48 +00:00
Zuul
15ccb776d7 Merge "Follow up punch_hole patch" 2019-11-14 01:17:19 +00:00
Zuul
4b78d66ff6 Merge "print deleted flag in account and container info cli" 2019-11-08 14:22:57 +00:00
Adrien Pensart
3de330ead3 print deleted flag in account and container info cli
Change-Id: I37c76e0c58a3d12b2062d5a6dbda2bf074f8bc9a
2019-11-08 12:03:20 +00:00
Darrell Bishop
1107f24179 Seamlessly reload servers with SIGUSR1
Swift servers can now be seamlessly reloaded by sending them a SIGUSR1
(instead of a SIGHUP).  The server forks off a synchronized child to
wait to close the old listen socket(s) until the new server has started
up and bound its listen socket(s).  The new server is exec'ed from the
old one so its PID doesn't change.  This makes Systemd happier, so a
ReloadExec= stanza can now be used.

The seamless part means that incoming connections will alwyas get
accepted either by the old server or the new one.  This eliminates
client-perceived "downtime" during server reloads, while allowing the
server to fully reload, re-reading configuration, becoming a fresh
Python interpreter instance, etc.  The SO_REUSEPORT socket option has
already been getting used, so nothing had to change there.

This patch also includes a non-invasive fix for a current eventlet bug;
see https://github.com/eventlet/eventlet/pull/590
That bug prevents a SIGHUP "reload" from properly servicing existing
requests before old worker processes close sockets and exit.  The
existing probtests missed this, but the new ones, in this patch, caught
it.

New probe tests cover both old SIGHUP "reload" behavior as well as the
new SIGUSR1 seamless reload behavior.

Change-Id: I3e5229d2fb04be67e53533ff65b0870038accbb7
2019-11-07 10:15:26 -08:00
SeongSoo Cho
7f6b09dc93 Add delete_account in InternalClient
Currently, The internal client module is missing a delete_account method.
I added a delete_account in InternalClient

Change-Id: I97cb090820b4099944ba49eaeb5b02f9bbcf1d58
Closes-Bug: #1680377
2019-11-07 15:32:21 +08:00
Zuul
b96dd047ad Merge "Get rid of _delete_db" 2019-11-07 04:04:05 +00:00
Tim Burke
30d99f5140 Get rid of _delete_db
It was parctically the same between both, only the table name was
different -- and we already have a way to accomodate that.

Change-Id: I112bef1cf44c7d6eeaacd30cea27cb71fb2e2406
2019-11-07 00:22:14 +00:00
SeongSoo Cho
7cb92810ac Fix bug internal client's delete_object logs 499
Internal Client's doest not read body for 404.
So, When internal deleing object that not existed, proxy-server logs
its response code to 499.

In this patch, add a code that drain the reponse body to prevent
unexpected disconnect in proxy-server

Change-Id: I6d170fead798d0d539c69d27a6fa8a2d0123ca99
Closes-Bug: #1835324
2019-11-06 09:49:04 +00:00
Zuul
af373a9cbc Merge "exclude utf8 tests under py3" 2019-10-30 00:39:25 +00:00
John Dickinson
0c1b485ad6 exclude utf8 tests under py3
These are known to not work until https://bugs.python.org/issue37093
is addressed in CPython upstream.

Change-Id: I4a6877907d14b632a9a477c887913488427b62b7
2019-10-29 20:12:05 +00:00
Clay Gerrard
dd235b6ac0 use request_helpers import namespace for tests
Change-Id: I8e18ff2036312d3049a420f3332a6ea6110447c4
2019-10-28 11:28:29 -05:00
Clay Gerrard
b75d593935 Refactor timestamp iter in db backend tests
Change-Id: I61d044a6d778e158af73a3f4d9fc75d642af0beb
2019-10-26 16:50:32 -05:00