Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions radosgw_agent/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def _meta_entry_from_json(entry):
'marker',
'timestamp',
'op',
'state',
'versioned',
'ver',
'name',
Expand Down Expand Up @@ -141,6 +142,7 @@ def _bi_entry_from_json(entry):
entry['op_id'],
entry['timestamp'],
entry.get('op', ''),
entry['state'],
entry.get('versioned', False),
entry_ver,
entry['object'],
Expand All @@ -149,6 +151,19 @@ def _bi_entry_from_json(entry):
)


def filter_pending_entry(entry):
"""
When put a object to radosgw, there are two bilog to generate.
One is "pending" state, the other is "complete" state.
This should be ignored when the entry is "pending" state,
otherwise the same object will be copied twice.
"""
if entry.op == 'write' and entry.state == 'pending':
return

return entry


def filter_versioned_objects(entry):
"""
On incremental sync operations, the log may indicate that 'olh' entries,
Expand Down Expand Up @@ -356,6 +371,9 @@ def inc_sync_bucket_instance(self, instance, marker, timestamp, retries):

# regardless if entries are versioned, make sure we filter them
entries = [i for i in ifilter(filter_versioned_objects, entries)]

# if entries are "pending" state, we ignore them.
entries = [i for i in ifilter(filter_pending_entry, entries)]

objects = set([entry for entry in entries])
bucket = self.get_bucket(instance)
Expand Down