Bases: swift.common.daemon.Daemon
Audit containers.
Audits the given container path
Parameters: | path – the path to a container db |
---|
Run the container audit until stopped.
Run the container audit once.
Pluggable Back-ends for Container Server
Bases: swift.common.db.DatabaseBroker
Encapsulates working with a container database.
Create the container_info table which is specific to the container DB. Not a part of Pluggable Back-ends, internal to the baseline code. Also creates the container_stat view.
Parameters: |
|
---|
Create the object table which is specific to the container DB. Not a part of Pluggable Back-ends, internal to the baseline code.
Parameters: | conn – DB connection object |
---|
Create policy_stat table.
Parameters: |
|
---|
Mark an object deleted.
Parameters: |
|
---|
Check if container DB is empty.
Returns: | True if the database has no active objects, False otherwise |
---|
Get global data for the container.
Returns: | dict with keys: account, container, created_at, put_timestamp, delete_timestamp, status_changed_at, object_count, bytes_used, reported_put_timestamp, reported_delete_timestamp, reported_object_count, reported_bytes_used, hash, id, x_container_sync_point1, x_container_sync_point2, and storage_policy_index. |
---|
Get the is_deleted status and info for the container.
Returns: | a tuple, in the form (info, is_deleted) info is a dict as returned by get_info and is_deleted is a boolean. |
---|
Get a list of objects which are in a storage policy different from the container’s storage policy.
Parameters: |
|
---|---|
Returns: | list of dicts with keys: name, created_at, size, content_type, etag, storage_policy_index |
Get a list of objects sorted by name starting at marker onward, up to limit entries. Entries will begin with the prefix and will not have the delimiter after the prefix.
Parameters: |
|
---|---|
Returns: | list of tuples of (name, created_at, size, content_type, etag) |
Merge items into the object table.
Parameters: |
|
---|
Creates an object in the DB with its metadata.
Parameters: |
|
---|
Update reported stats, available with container’s get_info.
Parameters: |
|
---|
Update the container_stat policy_index and status_changed_at.
Compare the data and meta related timestamps of a new object item with the timestamps of an existing object record, and update the new item with data and/or meta related attributes from the existing record if their timestamps are newer.
The multiple timestamps are encoded into a single string for storing in the ‘created_at’ column of the the objects db table.
Parameters: |
|
---|---|
Returns: | True if any attributes of the new item dict were found to be newer than the existing and therefore not updated, otherwise False implying that the updated item is equal to the existing. |
Bases: swift.common.base_storage_server.BaseStorageServer
WSGI Controller for the container server.
Handle HTTP DELETE request.
Handle HTTP GET request.
Handle HTTP HEAD request.
Handle HTTP POST request.
Handle HTTP PUT request.
Handle HTTP REPLICATE request (json-encoded RPC calls for replication.)
Update the account server(s) with latest container info.
Parameters: |
|
---|---|
Returns: | if all the account requests return a 404 error code, HTTPNotFound response object, if the account cannot be updated due to a malformed header, an HTTPBadRequest response object, otherwise None. |
The list of hosts we’re allowed to send syncs to. This can be overridden by data in self.realms_conf
Validate that the index supplied maps to a policy.
Returns: | policy index from request, or None if not present |
---|---|
Raises : | HTTPBadRequest if the supplied index is bogus |
ContainerSyncCluster instance for validating sync-to values.
Perform any mutations to container listing records that are common to all serialization formats, and returns it as a dict.
Converts created time to iso timestamp. Replaces size with ‘swift_bytes’ content type parameter.
Params record: | object entry record |
---|---|
Returns: | modified record |
paste.deploy app factory for creating WSGI container server apps
Convert container info dict to headers.
Bases: swift.common.db_replicator.Replicator
alias of ContainerBroker
Ensure that reconciler databases are only cleaned up at the end of the replication run.
Look for object rows for objects updates in the wrong storage policy in broker with a ROWID greater than the rowid given as point.
Parameters: |
|
---|---|
Returns: | the last successful enqueued rowid |
Add queue entries for rows in item_list to the local reconciler container database.
Parameters: |
|
---|---|
Returns: | True if successfully enqueued |
Look through devices in the ring for the first handoff device that was identified during job creation as available on this node.
Returns: | a node entry from the ring |
---|
Get a local instance of the reconciler container broker that is appropriate to enqueue the given timestamp.
Parameters: | timestamp – the timestamp of the row to be enqueued |
---|---|
Returns: | a local reconciler broker |
Ensure any items merged to reconciler containers during replication are pushed out to correct nodes and any reconciler containers that do not belong on this node are removed.
Bases: swift.common.daemon.Daemon
Daemon to sync syncable containers.
This is done by scanning the local devices for container databases and checking for x-container-sync-to and x-container-sync-key metadata values. If they exist, newer rows since the last sync will trigger PUTs or DELETEs to the other container.
The actual syncing is slightly more complicated to make use of the three (or number-of-replicas) main nodes for a container without each trying to do the exact same work but also without missing work if one node happens to be down.
Two sync points are kept per container database. All rows between the two sync points trigger updates. Any rows newer than both sync points cause updates depending on the node’s position for the container (primary nodes do one third, etc. depending on the replica count of course). After a sync run, the first sync point is set to the newest ROWID known and the second sync point is set to newest ROWID for which all updates have been sent.
An example may help. Assume replica count is 3 and perfectly matching ROWIDs starting at 1.
First sync run, database has 6 rows:
- SyncPoint1 starts as -1.
- SyncPoint2 starts as -1.
- No rows between points, so no “all updates” rows.
- Six rows newer than SyncPoint1, so a third of the rows are sent by node 1, another third by node 2, remaining third by node 3.
- SyncPoint1 is set as 6 (the newest ROWID known).
- SyncPoint2 is left as -1 since no “all updates” rows were synced.
Next sync run, database has 12 rows:
- SyncPoint1 starts as 6.
- SyncPoint2 starts as -1.
- The rows between -1 and 6 all trigger updates (most of which should short-circuit on the remote end as having already been done).
- Six more rows newer than SyncPoint1, so a third of the rows are sent by node 1, another third by node 2, remaining third by node 3.
- SyncPoint1 is set as 12 (the newest ROWID known).
- SyncPoint2 is set as 6 (the newest “all updates” ROWID).
In this way, under normal circumstances each node sends its share of updates each run and just sends a batch of older updates to ensure nothing was missed.
Parameters: |
|
---|
The list of hosts we’re allowed to send syncs to. This can be overridden by data in self.realms_conf
The dict of configuration values from the [container-sync] section of the container-server.conf.
Number of successful DELETEs triggered.
Number of containers that had a failure of some type.
Number of successful PUTs triggered.
swift.common.ring.Ring for locating containers.
Number of containers whose sync has been turned off, but are not yet cleared from the sync store.
Checks the given path for a container database, determines if syncing is turned on for that database and, if so, sends any updates to the other container.
Parameters: | path – the path to a container db |
---|
Sends the update the row indicates to the sync_to container. Update can be either delete or put.
Parameters: |
|
---|---|
Returns: | True on success |
Number of containers with sync turned on that were successfully synced.
Maximum amount of time to spend syncing a container before moving on to the next one. If a container sync hasn’t finished in this time, it’ll just be resumed next scan.
Path to the local device mount points.
Minimum time between full scans. This is to keep the daemon from running wild on near empty systems.
Logger to use for container-sync log lines.
Indicates whether mount points should be verified as actual mount points (normally true, false for tests and SAIO).
ContainerSyncCluster instance for validating sync-to values.
Writes a report of the stats to the logger and resets the stats for the next report.
Time of last stats report.
Runs container sync scans until stopped.
Runs a single container sync scan.
ContainerSyncStore instance for iterating over synced containers
Bases: swift.common.daemon.Daemon
Update container information in account listings.
Report container info to an account server.
Parameters: |
|
---|
Walk the path looking for container DBs and process them.
Parameters: | path – path to walk |
---|
Get the account ring. Load it if it hasn’t been yet.
Get paths to all of the partitions on each drive to be processed.
Returns: | a list of paths |
---|
Process a container, and update the information in the account.
Parameters: | dbfile – container DB to process |
---|
Run the updator continuously.
Run the updater once.