Commit Graph

351 Commits

Author SHA1 Message Date
indianwhocodes 11eb17d3b2 support x-open-expired header for expired objects
If the global configuration option 'enable_open_expired' is set
to true in the config, then the client will be able to make a
request with the header 'x-open-expired' set to true in order
to access an object that has expired, provided it is in its
grace period. If this config flag is set to false, the client
will not be able to access any expired objects, even with the
header, which is the default behavior unless the flag is set.

When a client sets a 'x-open-expired' header to a true value for a
GET/HEAD/POST request the proxy will forward x-backend-open-expired to
storage server. The storage server will allow clients that set
x-backend-open-expired to open and read an object that has not yet
been reaped by the object-expirer, even after the x-delete-at time
has passed.

The header is always ignored when used with temporary URLs.

Co-Authored-By: Anish Kachinthaya <akachinthaya@nvidia.com>
Related-Change: I106103438c4162a561486ac73a09436e998ae1f0
Change-Id: Ibe7dde0e3bf587d77e14808b169c02f8fb3dddb3
2024-04-26 10:13:40 +01:00
Takashi Kajinami 49b19613d2 Remove per-service auto_create_account_prefix
The per-service option was deprecated almost 4 years ago[1].

[1] 4601548dab

Change-Id: I45f7678c9932afa038438ee841d1b262d53c9da8
2023-11-22 01:58:03 +09:00
Tim Burke e5d730dc56 proxy: Get rid of iter_nodes helper
All it did was proxy through to NodeIter, anyway.

Change-Id: Ifec8d3a40f00141a73f6e50efe0b53b382ab2ef3
2023-08-16 10:16:18 -07:00
Tim Burke 0a4e41701d Add cap_length helper
Change-Id: Ib864c7dc6c8c7bb849f4f97a1239eb5cc04c424c
2023-04-05 20:54:39 -07:00
indianwhocodes 9ec90d4d56 proxy-server exception logging shows replication_ip/port
Adding a "use_replication" field to the node dict, a helper function to
set use_replication dict value for a node copy by looking up the header
value for x-backend-use-replication-network

Change-Id: Ie05af464765dc10cf585be851f462033fc6bdec7
2023-02-10 09:34:59 +00:00
Alistair Coles 7a0118fca0 proxy-server: include suppression time in error limit log
Also, add some more test coverage and tidy up some tests.

Change-Id: Icf3a1df87d52dc5f95e15e676da229a3323326a2
2022-11-21 10:52:11 +00:00
Jianjian Huo 38124221d7 Proxy: add metrics related to error limiter.
There are three new metrics added:
 1. 'error_limiter.incremented_limit', when one node has accumulated
    enough errors to trigger error suppression.
 2. 'error_limiter.forced_limit', when one node runs into serious
    error like Insufficient Storage.
 3. 'error_limiter.is_limited', when one node is error limited
    during node selection process due to suppression_limit.

UpgradeImpact:
There is change of log format when 'ERROR Insufficient Storage' is
raised, from '%(msg)s %(node)s' to
'Node will be error limited from now: %s, error: %s'.

Change-Id: Id9bec9b46dad82163517fd71cfdda5b751464588
2022-11-14 17:08:17 -08:00
Alistair Coles 623024848e proxy: extract response error handling to single method
This patch introduces a check_response method to proxy server
Application class. The method provides common checking and reporting
of backend response errors (i.e. responses with status code >=
500). This checking was previously duplicated in proxy controller
classes.

The formatting and content of error logging messages is now more
unform, which does result in changes to some logged error messages.

Change-Id: I4b935a47f39642c11364f2a8d50a5f2ebb3b84f1
2022-11-07 20:22:39 +00:00
Alistair Coles 51730f1273 proxy: refactor error limiter to a class
This patch pulls the proxy's error limiting code into an ErrorLimiter
class that can be used to provide error limiting.

Co-Authored-By: Matthew Oliver <matt@oliver.net.au>
Change-Id: Ie15d831278a55ffab156ddce04544317e451407d
2022-10-26 11:01:03 +01:00
Tim Burke a7af17394b Clean up some replication error messages
Lines like `Invalid response 500 from ::1` aren't terribly useful in an
all-in-one, while lines like

   Error syncing with node: {'device': 'd5', 'id': 3, 'ip': '::1',
   'meta': '', 'port': 6200, 'region': 1, 'replication_ip': '::1',
   'replication_port': 6200, 'weight': 8000.0, 'zone': 1, 'index': 0}:
   Timeout (60s)

are needlessly verbose.

While we're at it, introduce a node_to_string() helper, and use it in a
bunch of places.

Change-Id: I62b12f69e9ac44ce27ffaed320c0a3563673a018
2022-10-23 15:24:23 -07:00
Tim Burke 5c6407bf59 proxy: Add a chance to skip memcache for get_*_info calls
If you've got thousands of requests per second for objects in a single
container, you basically NEVER want that container's info to ever fall
out of memcache. If it *does*, all those clients are almost certainly
going to overload the container.

Avoid this by allowing some small fraction of requests to bypass and
refresh the cache, pushing out the TTL as long as there continue to be
requests to the container. The likelihood of skipping the cache is
configurable, similar to what we did for shard range sets.

Change-Id: If9249a42b30e2a2e7c4b0b91f947f24bf891b86f
Closes-Bug: #1883324
2022-08-30 18:49:48 +10:00
Zuul 713b944eb4 Merge "Proxy: override user_agent with backend_user_agent" 2022-02-16 02:13:33 +00:00
Alistair Coles eda7d5fe3c Deprecate LogAdapter.set_statsd_prefix
Previously, the set_statsd_prefix method was used to mutate a logger's
StatsdClient tail prefix after a logger was instantiated. This pattern
had led to unexpected mutations (see Related-Change). The tail_prefix
can now be passed as an argument to get_logger(), and is then
forwarded to the StatsdClient constructor, for a more explicit
assignment pattern.

The set_statsd_prefix method is left in place for backwards
compatibility. A DeprecationWarning will be raised if it is used
to mutate the StatsdClient tail prefix.

Change-Id: I7692860e3b741e1bc10626e26bb7b27399c325ab
Related-Change: I0522b1953722ca96021a0002cf93432b973ce626
2022-02-07 17:46:06 +00:00
Zuul 2a60c91f6f Merge "Make NodeIter require a logger argument" 2022-02-04 08:50:33 +00:00
Zuul e8cecf7fcc Merge "Move *_swift_info functions into a new registry module" 2022-02-04 07:01:15 +00:00
Matthew Oliver 589ac355f3 Move *_swift_info functions into a new registry module
The *_swift_info functions use in module global dicts to provide a
registry mechanism for registering and getting swift info.

This is an abnormal pattern and doesn't quite fit into utils. Further
we looking at following this pattern for sensitive info to trim in the
future.
So this patch does some house cleaning and moves this registry to a new
module swift.common.registry. And updates all the references to it.

For backwards compat we still import the *_swift_info methods into utils
for any 3rd party tools or middleware.

Change-Id: I71fd7f50d1aafc001d6905438f42de4e58af8421
2022-02-03 14:41:13 +00:00
Matthew Oliver b0245f4eb5 Proxy: override user_agent with backend_user_agent
The proxy currently _ALWAYS_ overrides any user_agent in requests with
`proxy-server <pid>`. This is what we want for any normal request. But
when using the internal client, which itself uses it's own proxy server,
we'd rather use the internal client's defined user_agent, so we can
track the source of the request in logs.

This patch adds a backend_user_agent to the proxy, that when set a proxy
will use this as a user_agent in a request.

Every member of the pipeline has a `_pipeline_final_app` to point to the
app (proxy), so uses this to directly set the proxies
backend_user_agent.

Closes-Bug: #1951304
Change-Id: I5f7bf65b4e747b5a93b79328fac640b791ecdc95
2022-01-28 09:46:56 -06:00
Alistair Coles a50726f27a Make NodeIter require a logger argument
Change-Id: I0f5477f383e496ec94816439d404ad6a4cfc075b
2022-01-27 09:06:22 -08:00
Alistair Coles 6942b25cc1 Fix statsd prefix mutation in proxy controllers
Swift loggers encapsulate a StatsdClient that is typically initialised
with a prefix, equal to the logger name (e.g. 'proxy_server'), that is
prepended to metrics names. The proxy server would previously mutate
its logger's prefix, using its set_statsd_prefix method, each time a
controller was instantiated, extending it with the controller type
(e.g. changing the prefix 'proxy_server.object'). As a result, when an
object request spawned container subrequests, for example, the statsd
client would be left with a 'proxy_server.container' prefix part for
subsequent object request related metrics.

The proxy server logger is now wrapped with a new
MetricsPrefixLoggerAdapter each time a controller is instantiated, and
the adapter applies the correct prefix for the controller type for the
lifetime of the controller.

Change-Id: I0522b1953722ca96021a0002cf93432b973ce626
2022-01-27 09:06:15 -08:00
Tim Burke 8c6ccb5fd4 proxy: Add a chance to skip memcache when looking for shard ranges
By having some small portion of calls skip cache and go straight to
disk, we can ensure the cache is always kept fresh and never expires (at
least, for active containers). Previously, when shard ranges fell out of
cache there would frequently be a thundering herd that could overwhelm
the container server, leading to 503s served to clients or an increase
in async pendings.

Include metrics for hit/miss/skip rates.

Change-Id: I6d74719fb41665f787375a08184c1969c86ce2cf
Related-Bug: #1883324
2022-01-26 18:15:09 +00:00
Tim Burke f1c411c529 proxy: Remove a bunch of logging translations
Change-Id: I2ffacdbd70c72e091825164da24cc87ea67721d7
Partial-Bug: #1674543
2021-10-22 08:23:06 -07:00
Tim Burke eacebbb167 Allow floats for a couple more intervals
Somehow I missed these on the first go-round.

Change-Id: I8baef6ba35a2f59eac30695943a671d53228e75c
Related-Change: I91e9bc02d94fe7ea6e89307305705c383087845a
2021-06-07 15:34:19 -07:00
Alistair Coles 46ea3aeae8 Quarantine stale EC fragments after checking handoffs
If the reconstructor finds a fragment that appears to be stale then it
will now quarantine the fragment.  Fragments are considered stale if
insufficient fragments at the same timestamp can be found to rebuild
missing fragments, and the number found is less than or equal to a new
reconstructor 'quarantine_threshold' config option.

Before quarantining a fragment the reconstructor will attempt to fetch
fragments from handoff nodes in addition to the usual primary nodes.
The handoff requests are limited by a new 'request_node_count'
config option.

'quarantine_threshold' defaults to zero i.e. no fragments will be
quarantined. 'request node count' defaults to '2 * replicas'.

Closes-Bug: 1655608

Change-Id: I08e1200291833dea3deba32cdb364baa99dc2816
2021-05-10 20:45:17 +01:00
Alistair Coles 077ba77ea6 Use cached shard ranges for container GETs
This patch makes four significant changes to the handling of GET
requests for sharding or sharded containers:
  - container server GET requests may now result in the entire list of
    shard ranges being returned for the 'listing' state regardless of
    any request parameter constraints.
  - the proxy server may cache that list of shard ranges in memcache
    and the requests environ infocache dict, and subsequently use the
    cached shard ranges when handling GET requests for the same
    container.
  - the proxy now caches more container metadata so that it can
    synthesize a complete set of container GET response headers from
    cache.
  - the proxy server now enforces more container GET request validity
    checks that were previously only enforced by the backend server,
    e.g. checks for valid request parameter values

With this change, when the proxy learns from container metadata
that the container is sharded then it will cache shard
ranges fetched from the backend during a container GET in memcache.
On subsequent container GETs the proxy will use the cached shard
ranges to gather object listings from shard containers, avoiding
further GET requests to the root container until the cached shard
ranges expire from cache.

Cached shard ranges are most useful if they cover the entire object
name space in the container. The proxy therefore uses a new
X-Backend-Override-Shard-Name-Filter header to instruct the container
server to ignore any request parameters that would constrain the
returned shard range listing i.e. 'marker', 'end_marker', 'includes'
and 'reverse' parameters.  Having obtained the entire shard range
listing (either from the server or from cache) the proxy now applies
those request parameter constraints itself when constructing the
client response.

When using cached shard ranges the proxy will synthesize response
headers from the container metadata that is also in cache. To enable
the full set of container GET response headers to be synthezised in
this way, the set of metadata that the proxy caches when handling a
backend container GET response is expanded to include various
timestamps.

The X-Newest header may be used to disable looking up shard ranges
in cache.

Change-Id: I5fc696625d69d1ee9218ee2a508a1b9be6cf9685
2021-01-06 16:28:49 +00:00
Samuel Merritt b971280907 Let developers/operators add watchers to object audit
Swift operators may find it useful to operate on each object in their
cluster in some way. This commit provides them a way to hook into the
object auditor with a simple, clearly-defined boundary so that they
can iterate over their objects without additional disk IO.

For example, a cluster operator may want to ensure a semantic
consistency with all SLO segments accounted in their manifests,
or locate objects that aren't in container listings. Now that Swift
has encryption support, this could be used to locate unencrypted
objects. The list goes on.

This commit makes the auditor locate, via entry points, the watchers
named in its config file.

A watcher is a class with at least these four methods:

   __init__(self, conf, logger, **kwargs)

   start(self, audit_type, **kwargs)

   see_object(self, object_metadata, data_file_path, **kwargs)

   end(self, **kwargs)

The auditor will call watcher.start(audit_type) at the start of an
audit pass, watcher.see_object(...) for each object audited, and
watcher.end() at the end of an audit pass. All method arguments are
passed as keyword args.

This version of the API is implemented on the context of the
auditor itself, without spawning any additional processes.
If the plugins are not working well -- hang, crash, or leak --
it's easier to debug them when there's no additional complication
of processes that run by themselves.

In addition, we include a reference implementation of plugin for
the watcher API, as a help to plugin writers.

Change-Id: I1be1faec53b2cdfaabf927598f1460e23c206b0a
2020-12-26 17:16:14 -06:00
Zuul b9a404b4d1 Merge "ec: Add an option to write fragments with legacy crc" 2020-11-02 23:03:49 +00:00
Tim Burke 599f63e762 ec: Add an option to write fragments with legacy crc
When upgrading from liberasurecode<=1.5.0, you may want to continue
writing legacy CRCs until all nodes are upgraded and capabale of reading
fragments with zlib CRCs.

Starting in liberasurecode>=1.6.2, we can use the environment variable
LIBERASURECODE_WRITE_LEGACY_CRC to control whether we write zlib or
legacy CRCs, but for many operators it's easier to manage swift configs
than environment variables. Add a new option, write_legacy_ec_crc, to the
proxy-server app and object-reconstructor; if set to true, ensure legacy
frags are written.

Note that more daemons instantiate proxy-server apps than just the
proxy-server. The complete set of impacted daemons should be:

  * proxy-server
  * object-reconstructor
  * container-reconciler
  * any users of internal-client.conf

UpgradeImpact
=============
To ensure a smooth liberasurecode upgrade:

 1. Determine whether your cluster writes legacy or zlib CRCs. Depending
    on the order in which shared libraries are loaded, your servers may
    already be reading and writing zlib CRCs, even with old
    liberasurecode. In that case, no special action is required and
    WRITING LEGACY CRCS DURING THE UPGRADE WILL CAUSE AN OUTAGE.
    Just upgrade liberasurecode normally. See the closed bug for more
    information and a script to determine which CRC is used.
 2. On all nodes, ensure Swift is upgraded to a version that includes
    write_legacy_ec_crc support and write_legacy_ec_crc is enabled on
    all daemons.
 3. On each node, upgrade liberasurecode and restart Swift services.
    Because of (2), they will continue writing legacy CRCs which will
    still be readable by nodes that have not yet upgraded.
 4. Once all nodes are upgraded, remove the write_legacy_ec_crc option
    from all configs across all nodes. After restarting daemons, they
    will write zlib CRCs which will also be readable by all nodes.

Change-Id: Iff71069f808623453c0ff36b798559015e604c7d
Related-Bug: #1666320
Closes-Bug: #1886088
Depends-On: https://review.opendev.org/#/c/738959/
2020-09-30 16:49:59 -07:00
Clay Gerrard 754defc39c Client should retry when there's just one 404 and a bunch of errors
During a rebalance, it's expected that we may get a 404 for data that
does exist elsewhere in the cluster. Normally this isn't a problem; the
proxy sees the 404, keeps digging, and one of the other primaries will
serve the response.

Previously, if the other replicas were heavily loaded, the proxy would
see a bunch of timeouts and the fresh (empty) primary, treat the 404 as
good, and send that on to the client.

Now, have the proxy throw out that first 404 (provided it doesn't have a
timestamp); it will then return a 503 to the client, indicating that it
should try again.

Add a new (per-policy) proxy-server config option,
rebalance_missing_suppression_count; operators may use this to increase
the number of 404-no-timestamp responses to discard if their rebalances
are going faster than replication can keep up, or set it to zero to
return to the previous behavior.

Change-Id: If4bd39788642c00d66579b26144af8f116735b4d
2020-09-08 14:33:09 -07:00
Clay Gerrard f043aedec1 Make all concurrent_get options per-policy
Change-Id: Ib81f77cc343c3435d7e6258d4631563fa022d449
2020-09-02 12:11:49 -05:00
Clay Gerrard 8f60e0a260 Extend concurrent_gets to EC GET requests
After the initial requests are started, if the proxy still does not have
enough backend responses to return a client response additional requests
will be spawned to remaining primaries at the frequency configured by
the concurrency_timeout.

A new tunable concurrent_ec_extra_requests allows operators to control
how many requests to backend fragments are started immediately with a
client request to an object stored in an EC storage policy.  By default
the minimum ndata backend requests are started immediately, but
operators may increase concurrent_ec_extra_requests up to nparity which
is similar in effect to a concurrency_timeout of 0.

Change-Id: Ia0a9398107a400815be2e0097b1b8e76336a0253
2020-08-24 13:30:44 -05:00
Tim Burke 45be775ebf Get rid of memcache attr on proxy-server app
In a running proxy server, this only ever comes from one place:
a key in the wsgi env, populated by the memcache middleware. By
littering proxy controller code with things like

   memcache = getattr(app, 'memcache', None) or env.get('swift.cache')

we cause ourselves to second-guess that.

Change-Id: Ia652b1381990b61194978c4efaebac7d2a602ca3
2020-06-26 21:44:46 -07:00
Romain LE DISEZ 8378a11d11 Replace all "with Chunk*Timeout" by a watchdog
The contextmanager eventlet.timeout.Timeout is scheduling a call to
throw an exception every time is is entered. The swift-proxy uses
Chunk(Read|Write)Timeout for every chunk read/written from the client or
object-server. For a single upload/download of a big object, it means
tens of thousands of scheduling in eventlet, which is very costly.

This patch replace the usage of these context managers by a watchdog
greenthread that will schedule itself by sleeping until the next timeout
expiration. Then, only if a timeout expired, it will schedule a call to
throw the appropriate exception.

The gain on bandwidth and CPU usage is significant. On a benchmark
environment, it gave this result for an upload of 6 Gbpson a replica
policy (average of 3 runs):
    master: 5.66 Gbps / 849 jiffies consumed by the proxy-server
    this patch: 7.56 Gbps / 618 jiffies consumed by the proxy-server

Change-Id: I19fd42908be5a6ac5905ba193967cd860cb27a0b
2020-04-02 07:38:47 -04:00
Clay Gerrard dc40779307 Use float consistently for proxy timeout settings
Change-Id: I433c97df99193ec31c863038b9b6fd20bb3705b8
2020-03-02 10:44:48 -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
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
Romain LE DISEZ 2f1111a436 proxy: stop sending chunks to objects with a Queue
During a PUT of an object, the proxy instanciates one Putter per
object-server that will store data (either the full object or a
fragment, depending on the storage policy). Each Putter is owning a
Queue that will be used to bufferize data chunks before they are
written to the socket connected to the object-server. The chunks are
moved from the queue to the socket by a greenthread. There is one
greenthread per Putter. If the client is uploading faster than the
object-servers can manage, the Queue could grow and consume a lot of
memory. To avoid that, the queue is bounded (default: 10). Having a
bounded queue also allows to ensure that all object-servers will get
the data at the same rate because if one queue is full, the
greenthread reading from the client socket will block when trying to
write to the queue. So the global rate is the one of the slowest
object-server.

The thing is, every operating system manages socket buffers for incoming
and outgoing data. Concerning the send buffer, the behavior is such that
if the buffer is full, a call to write() will block, otherwise the call
will return immediately. It behaves a lot like the Putter's Queue,
except that the size of the buffer is dynamic so it adapts itself to the
speed of the receiver.

Thus, managing a queue in addition to the socket send buffer is a
duplicate queueing/buffering that provides no interest but is, as shown
by profiling and benchmarks, very CPU costly.

This patch removes the queuing mecanism. Instead, the greenthread
reading data from the client will directly write to the socket. If an
object-server is getting slow, the buffer will fulfill, blocking the
reader greenthread. Benchmark shows a CPU consumption reduction of more
than 30% will the observed rate for an upload is increasing by about
45%.

Change-Id: Icf8f800cb25096f93d3faa1e6ec091eb29500758
2019-11-07 18:01:58 +08:00
Tim Burke bf9346d88d Fix some request-smuggling vectors on py3
A Python 3 bug causes us to abort header parsing in some cases. We
mostly worked around that in the related change, but that was *after*
eventlet used the parsed headers to determine things like message
framing. As a result, a client sending a malformed request (for example,
sending both Content-Length *and* Transfer-Encoding: chunked headers)
might have that request parsed properly and authorized by a proxy-server
running Python 2, but the proxy-to-backend request could get misparsed
if the backend is running Python 3. As a result, the single client
request could be interpretted as multiple requests by an object server,
only the first of which was properly authorized at the proxy.

Now, after we find and parse additional headers that weren't parsed by
Python, fix up eventlet's wsgi.input to reflect the message framing we
expect given the complete set of headers. As an added precaution, if the
client included Transfer-Encoding: chunked *and* a Content-Length,
ensure that the Content-Length is not forwarded to the backend.

Change-Id: I70c125df70b2a703de44662adc66f740cc79c7a9
Related-Change: I0f03c211f35a9a49e047a5718a9907b515ca88d7
Closes-Bug: 1840507
2019-10-02 08:20:20 -07:00
Tim Burke a1af3811a7 sharding: Cache shard ranges for object writes
Previously, we issued a GET to the root container for every object PUT,
POST, and DELETE. This puts load on the container server, potentially
leading to timeouts, error limiting, and erroneous 404s (!).

Now, cache the complete set of 'updating' shards, and find the shard for
this particular update in the proxy. Add a new config option,
recheck_updating_shard_ranges, to control the cache time; it defaults to
one hour. Set to 0 to fall back to previous behavior.

Note that we should be able to tolerate stale shard data just fine; we
already have to worry about async pendings that got written down with
one shard but may not get processed until that shard has itself sharded
or shrunk into another shard.

Also note that memcache has a default value limit of 1MiB, which may be
exceeded if a container has thousands of shards. In that case, set()
will act like a delete(), causing increased memcache churn but otherwise
preserving existing behavior. In the future, we may want to add support
for gzipping the cached shard ranges as they should compress well.

Change-Id: Ic7a732146ea19a47669114ad5dbee0bacbe66919
Closes-Bug: 1781291
2019-07-11 10:40:38 -07:00
Clay Gerrard 82169ead1c Don't handle object without container
Closes-Bug: #1833616

Change-Id: I16ca1589abcea2bca942da7e97719286a8961ea6
2019-06-24 16:58:09 -05:00
Tim Burke ff04ef05cd Rework private-request-method interface
Instead of taking a X-Backend-Allow-Method that *must match* the
REQUEST_METHOD, take a truish X-Backend-Allow-Private-Methods and
expand the set of allowed methods. This allows us to also expose
the full list of available private methods when returning a 405.

Drive-By: make async-delete tests a little more robust:
  * check that end_marker and prefix are preserved on subsequent
    listings
  * check that objects with a leading slash are correctly handled

Change-Id: I5542623f16e0b5a0d728a6706343809e50743f73
2019-05-22 16:36:50 -07:00
Tim Burke 83d0161991 Add operator tool to async-delete some or all objects in a container
Adds a tool, swift-container-deleter, that takes an account/container
and optional prefix, marker, and/or end-marker; spins up an internal
client; makes listing requests against the container; and pushes the
found objects into the object-expirer queue with a special
application/async-deleted content-type.

In order to do this enqueuing efficiently, a new internal-to-the-cluster
container method is introduced: UPDATE. It takes a JSON list of object
entries and runs them through merge_items.

The object-expirer is updated to look for work items with this
content-type and skip the X-If-Deleted-At check that it would normally
do.

Note that the target-container's listing will continue to show the
objects until data is actually deleted, bypassing some of the concerns
raised in the related change about clearing out a container entirely and
then deleting it.

Change-Id: Ia13ee5da3d1b5c536eccaadc7a6fdcd997374443
Related-Change: I50e403dee75585fc1ff2bb385d6b2d2f13653cf8
2019-05-22 13:22:50 -07:00
Tim Burke 8b3d0a6c64 py3: finish porting proxy/test_server.py
Change-Id: I8287db75b4f19581203360c646e72f64fe45f170
2019-05-08 17:47:40 -07:00
Tim Burke 259224f009 py3: port unit/proxy/test_server.py
All except the versioned_writes tests, which are hairy.

Change-Id: Ieb54869f93a70c8887d33bd2ad46cf04a190d896
2019-05-08 15:59:06 -07:00
Zuul f9898ec8f3 Merge "[Trivial fix]Remove unnecessary slash" 2019-05-07 11:27:51 +00:00
zhufl 6d63297f02 [Trivial fix]Remove unnecessary slash
This is to remove the unncessary slash when the line doesn't
exceed the length of 79, to make the code more readable.

Change-Id: I31070067913560d6147f95d0fdfba4f9f9ce0936
2019-05-06 14:23:05 +08:00
Tim Burke b8284538be py3: start porting for unit/proxy/test_server.py
Mostly this ammounts to

    Exception.message -> Exception.args[0]
    '...' -> b'...'
    StringIO -> BytesIO
    makefile() -> makefile('rwb')
    iter.next() -> next(iter)
    bytes[n] -> bytes[n:n + 1]
    integer division

Note that the versioning tests are mostly untouched; they seemed to get
a little hairy.

Change-Id: I167b5375e7ed39d4abecf0653f84834ea7dac635
2019-05-04 20:35:05 -07:00
Pete Zaitcev 988e719232 py3: port object controller in proxy
When looking at the tuple thing, remember that tuples are comparable
with ints in py2, but they do not compare like (100)[0]. Instead, they
are always greater, acting almost like MAX_INT. No wonder py3 banned
that practice.

We had a much of other noncomparables, but we dealt with them in
obvious ways, like adding key= to sorted().

Change-Id: I52e96406c3c1f39b98c1d81bdc057805cd1a6278
2019-02-06 00:26:39 -06:00
Zuul 76a3908667 Merge "Add validation for sorting_method values" 2018-10-11 02:34:31 +00:00
Tim Burke 78344bfe25 py3: get proxy-server willing and able to respond to some API requests
I saw GET account/container/replicated object all work,
which is not too shabby.

Change-Id: I63408274fb76a4e9920c00a2ce2829ca6d9982ca
2018-09-17 13:03:25 -07:00
Tim Burke 783c7f6117 py3: port proxy/controllers/info.py
Yes, this means you can now start a proxy-server process on py3! And it
will give you something useful on /info!

Apparently you can even get auth tokens from tempauth, although the
tempauth unit tests don't pass yet.

Change-Id: I86ead2989b5934a7584cdd75719ce239826e01ec
2018-06-28 09:58:44 -07:00