swift 2.32.1__py2.py3-none-any.whl → 2.33.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. swift/account/server.py +1 -11
  2. swift/cli/info.py +28 -1
  3. swift-2.32.1.data/scripts/swift-recon-cron → swift/cli/recon_cron.py +4 -13
  4. swift/cli/reload.py +141 -0
  5. swift/common/daemon.py +12 -2
  6. swift/common/db.py +12 -8
  7. swift/common/http_protocol.py +76 -3
  8. swift/common/manager.py +18 -5
  9. swift/common/memcached.py +18 -12
  10. swift/common/middleware/proxy_logging.py +35 -27
  11. swift/common/middleware/s3api/acl_handlers.py +1 -1
  12. swift/common/middleware/s3api/controllers/__init__.py +3 -0
  13. swift/common/middleware/s3api/controllers/acl.py +3 -2
  14. swift/common/middleware/s3api/controllers/logging.py +2 -2
  15. swift/common/middleware/s3api/controllers/multi_upload.py +30 -6
  16. swift/common/middleware/s3api/controllers/object_lock.py +44 -0
  17. swift/common/middleware/s3api/s3api.py +4 -0
  18. swift/common/middleware/s3api/s3request.py +19 -12
  19. swift/common/middleware/s3api/s3response.py +13 -2
  20. swift/common/middleware/s3api/utils.py +1 -1
  21. swift/common/middleware/slo.py +395 -298
  22. swift/common/middleware/staticweb.py +45 -14
  23. swift/common/middleware/tempurl.py +132 -91
  24. swift/common/request_helpers.py +32 -8
  25. swift/common/storage_policy.py +1 -1
  26. swift/common/swob.py +5 -2
  27. swift/common/utils/__init__.py +230 -135
  28. swift/common/utils/timestamp.py +23 -2
  29. swift/common/wsgi.py +8 -0
  30. swift/container/backend.py +126 -21
  31. swift/container/replicator.py +42 -6
  32. swift/container/server.py +264 -145
  33. swift/container/sharder.py +50 -30
  34. swift/container/updater.py +1 -0
  35. swift/obj/auditor.py +2 -1
  36. swift/obj/diskfile.py +55 -19
  37. swift/obj/expirer.py +1 -13
  38. swift/obj/mem_diskfile.py +2 -1
  39. swift/obj/mem_server.py +1 -0
  40. swift/obj/replicator.py +2 -2
  41. swift/obj/server.py +12 -23
  42. swift/obj/updater.py +1 -0
  43. swift/obj/watchers/dark_data.py +72 -34
  44. swift/proxy/controllers/account.py +3 -2
  45. swift/proxy/controllers/base.py +217 -127
  46. swift/proxy/controllers/container.py +274 -289
  47. swift/proxy/controllers/obj.py +98 -141
  48. swift/proxy/server.py +2 -12
  49. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-info +3 -0
  50. swift-2.33.1.data/scripts/swift-recon-cron +24 -0
  51. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/AUTHORS +3 -1
  52. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/METADATA +4 -3
  53. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/RECORD +94 -91
  54. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/WHEEL +1 -1
  55. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/entry_points.txt +1 -0
  56. swift-2.33.1.dist-info/pbr.json +1 -0
  57. swift-2.32.1.dist-info/pbr.json +0 -1
  58. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-account-audit +0 -0
  59. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-account-auditor +0 -0
  60. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-account-info +0 -0
  61. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-account-reaper +0 -0
  62. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-account-replicator +0 -0
  63. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-account-server +0 -0
  64. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-config +0 -0
  65. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-auditor +0 -0
  66. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-reconciler +0 -0
  67. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-replicator +0 -0
  68. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-server +0 -0
  69. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-sharder +0 -0
  70. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-sync +0 -0
  71. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-container-updater +0 -0
  72. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-dispersion-populate +0 -0
  73. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-dispersion-report +0 -0
  74. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-drive-audit +0 -0
  75. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-form-signature +0 -0
  76. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-get-nodes +0 -0
  77. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-init +0 -0
  78. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-auditor +0 -0
  79. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-expirer +0 -0
  80. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-info +0 -0
  81. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-reconstructor +0 -0
  82. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-relinker +0 -0
  83. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-replicator +0 -0
  84. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-server +0 -0
  85. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-object-updater +0 -0
  86. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-oldies +0 -0
  87. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-orphans +0 -0
  88. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-proxy-server +0 -0
  89. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-recon +0 -0
  90. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-reconciler-enqueue +0 -0
  91. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-ring-builder +0 -0
  92. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-ring-builder-analyzer +0 -0
  93. {swift-2.32.1.data → swift-2.33.1.data}/scripts/swift-ring-composer +0 -0
  94. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/LICENSE +0 -0
  95. {swift-2.32.1.dist-info → swift-2.33.1.dist-info}/top_level.txt +0 -0
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # This is an audit watcher that manages the dark data in the cluster.
18
18
  # Since the API for audit watchers is intended to use external plugins,
19
- # this code is invoked as if it were external: through pkg_resources.
19
+ # this code is invoked as if it were external: through load_pkg_resources().
20
20
  # Our setup.py comes pre-configured for convenience, but the operator has
21
21
  # to enable this watcher honestly by additing DarkDataWatcher to watchers=
22
22
  # in object-server.conf. The default is off, as if this does not exist.
@@ -42,6 +42,10 @@ servers agree, it will silently fail to detect anything if even one
42
42
  of container servers in the ring is down or unreacheable. This is
43
43
  done in the interest of operators who run with action=delete.
44
44
 
45
+ If a container is sharded, there is a small edgecase where an object row could
46
+ be misplaced. So it is recommended to always start with action=log, before
47
+ your confident to run action=delete.
48
+
45
49
  Finally, keep in mind that Dark Data watcher needs the container
46
50
  ring to operate, but runs on an object node. This can come up if
47
51
  cluster has nodes separated by function.
@@ -57,7 +61,7 @@ from eventlet import Timeout
57
61
  from swift.common.direct_client import direct_get_container
58
62
  from swift.common.exceptions import ClientException, QuarantineRequest
59
63
  from swift.common.ring import Ring
60
- from swift.common.utils import split_path, Timestamp
64
+ from swift.common.utils import split_path, Namespace, Timestamp
61
65
 
62
66
 
63
67
  class ContainerError(Exception):
@@ -114,7 +118,7 @@ class DarkDataWatcher(object):
114
118
 
115
119
  obj_path = object_metadata['name']
116
120
  try:
117
- obj_info = get_info_1(self.container_ring, obj_path, self.logger)
121
+ obj_info = get_info_1(self.container_ring, obj_path)
118
122
  except ContainerError:
119
123
  self.tot_unknown += 1
120
124
  return
@@ -137,39 +141,73 @@ class DarkDataWatcher(object):
137
141
  #
138
142
  # Get the information for 1 object from container server
139
143
  #
140
- def get_info_1(container_ring, obj_path, logger):
144
+ def get_info_1(container_ring, obj_path):
141
145
 
142
146
  path_comps = split_path(obj_path, 1, 3, True)
143
147
  account_name = path_comps[0]
144
148
  container_name = path_comps[1]
145
149
  obj_name = path_comps[2]
146
-
147
- container_part, container_nodes = \
148
- container_ring.get_nodes(account_name, container_name)
149
-
150
- if not container_nodes:
151
- raise ContainerError()
152
-
153
- # Perhaps we should do something about the way we select the container
154
- # nodes. For now we just shuffle. It spreads the load, but it does not
155
- # improve upon the the case when some nodes are down, so auditor slows
156
- # to a crawl (if this plugin is enabled).
157
- random.shuffle(container_nodes)
158
-
159
- err_flag = 0
160
- for node in container_nodes:
161
- try:
162
- headers, objs = direct_get_container(
163
- node, container_part, account_name, container_name,
164
- prefix=obj_name, limit=1)
165
- except (ClientException, Timeout):
166
- # Something is wrong with that server, treat as an error.
167
- err_flag += 1
168
- continue
169
- if objs and objs[0]['name'] == obj_name:
170
- return objs[0]
171
-
172
- # We only report the object as dark if all known servers agree that it is.
173
- if err_flag:
174
- raise ContainerError()
175
- return None
150
+ visited = set()
151
+
152
+ def check_container(account_name, container_name):
153
+ record_type = 'auto'
154
+ if (account_name, container_name) in visited:
155
+ # Already queried; So we have a last ditch effort and specifically
156
+ # ask for object data as this could be pointing back to the root
157
+ # If the container doesn't have objects then this will return
158
+ # no objects and break the loop.
159
+ record_type = 'object'
160
+ else:
161
+ visited.add((account_name, container_name))
162
+
163
+ container_part, container_nodes = \
164
+ container_ring.get_nodes(account_name, container_name)
165
+ if not container_nodes:
166
+ raise ContainerError()
167
+
168
+ # Perhaps we should do something about the way we select the container
169
+ # nodes. For now we just shuffle. It spreads the load, but it does not
170
+ # improve upon the the case when some nodes are down, so auditor slows
171
+ # to a crawl (if this plugin is enabled).
172
+ random.shuffle(container_nodes)
173
+
174
+ err_flag = 0
175
+ shards = set()
176
+ for node in container_nodes:
177
+ try:
178
+ # The prefix+limit trick is used when a traditional listing
179
+ # is returned, while includes is there for shards.
180
+ # See the how GET routes it in swift/container/server.py.
181
+ headers, objs_or_shards = direct_get_container(
182
+ node, container_part, account_name, container_name,
183
+ prefix=obj_name, limit=1,
184
+ extra_params={'includes': obj_name, 'states': 'listing'},
185
+ headers={'X-Backend-Record-Type': record_type})
186
+ except (ClientException, Timeout):
187
+ # Something is wrong with that server, treat as an error.
188
+ err_flag += 1
189
+ continue
190
+ if headers.get('X-Backend-Record-Type') == 'shard':
191
+ # When using includes=obj_name, we don't need to anything
192
+ # like find_shard_range(obj_name, ... objs_or_shards).
193
+ if len(objs_or_shards) != 0:
194
+ namespace = Namespace(objs_or_shards[0]['name'],
195
+ objs_or_shards[0]['lower'],
196
+ objs_or_shards[0]['upper'])
197
+ shards.add((namespace.account, namespace.container))
198
+ continue
199
+ if objs_or_shards and objs_or_shards[0]['name'] == obj_name:
200
+ return objs_or_shards[0]
201
+
202
+ # If we got back some shards, recurse
203
+ for account_name, container_name in shards:
204
+ res = check_container(account_name, container_name)
205
+ if res:
206
+ return res
207
+
208
+ # We only report the object as dark if all known servers agree to it.
209
+ if err_flag:
210
+ raise ContainerError()
211
+ return None
212
+
213
+ return check_container(account_name, container_name)
@@ -63,8 +63,9 @@ class AccountController(Controller):
63
63
  partition = self.app.account_ring.get_part(self.account_name)
64
64
  concurrency = self.app.account_ring.replica_count \
65
65
  if self.app.get_policy_options(None).concurrent_gets else 1
66
- node_iter = NodeIter(self.app, self.app.account_ring, partition,
67
- self.logger, req)
66
+ node_iter = NodeIter(
67
+ 'account', self.app, self.app.account_ring, partition,
68
+ self.logger, req)
68
69
  params = req.params
69
70
  params['format'] = 'json'
70
71
  req.params = params