from radosgw_agent import request as aws_request
from radosgw_agent import exceptions as exc
+from radosgw_agent.constants import DEFAULT_TIME
log = logging.getLogger(__name__)
def set_worker_bound(connection, type_, marker, timestamp,
- daemon_id, id_, data=None):
+ daemon_id, id_, data=None, sync_type='incremental'):
+ """
+
+ :param sync_type: The type of synchronization that should be attempted by
+ the agent, defaulting to "incremental" but can also be "full".
+ """
if data is None:
data = []
key = _id_name(type_)
'marker': marker,
'time': timestamp,
'daemon_id': daemon_id,
+ 'sync-type': sync_type,
},
data=json.dumps(data),
special_first_param='work_bound',
def get_worker_bound(connection, type_, id_):
key = _id_name(type_)
- out = request(
- connection, 'get', 'admin/replica_log',
- params={
- 'type': type_,
- key: id_,
- },
- special_first_param='bounds',
+ try:
+ out = request(
+ connection, 'get', 'admin/replica_log',
+ params={
+ 'type': type_,
+ key: id_,
+ },
+ special_first_param='bounds',
+ )
+ boto.log.debug('get_worker_bound returned: %r', out)
+ except exc.NotFound:
+ log.debug('no worker bound found for bucket instance "%s"',
+ id_)
+ # return fallback, default values
+ return dict(
+ marker=' ',
+ timestamp=DEFAULT_TIME,
+ retries=[]
)
- boto.log.debug('get_worker_bound returned: %r', out)
+
retries = set()
for item in out['markers']:
names = [retry['name'] for retry in item['items_in_progress']]
retries = retries.union(names)
- return out['marker'], out['oldest_time'], retries
+ out['retries'] = retries
+ return out
class Zone(object):