Skip to content

Commit

Permalink
replication recovery: add all option to scan all objects in a bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
IrakozeFD authored and fvennetier committed Jan 31, 2025
1 parent c3749e7 commit 2530acd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions oio/cli/replication/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ def get_parser(self, prog_name):
action="store_true",
help="Resend only events from objects with metadatata to be replicated",
)
parser.add_argument(
"--all",
action="store_true",
help="Resend events from all objects",
)
parser.add_argument(
"--until",
help="Date (timestamp) until which the objects must be checked. "
Expand Down Expand Up @@ -488,12 +493,14 @@ def take_action(self, parsed_args):
pending = parsed_args.pending
only_metadata = parsed_args.only_metadata
use_marker = parsed_args.use_marker
all = parsed_args.all
marker_update_after = parsed_args.marker_update_after
if pending and only_metadata:
if (pending and only_metadata) or (pending and all) or (only_metadata and all):
raise ValueError(
"Cannot use both pending and only-metadata options at the same time"
"Options conflict: cannot combine 'pending', 'only-metadta' and"
" 'all' options. Only one option at a time is supported"
)
elif not (pending or only_metadata):
elif not (pending or only_metadata or all):
# When no option is defined, use pending by default
pending = True
until = int(parsed_args.until) * 1000000 if parsed_args.until else None
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/cli/replication/test_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def _test_recovery_tool(
option = "--pending --only-metadata --use-marker 2"
self.assertRaisesRegex(
CommandFailed,
"Cannot use both pending and only-metadata options at the same time",
"Options conflict: cannot combine 'pending', 'only-metadta' "
"and 'all' options. Only one option at a time is supported",
lambda: self.openio(
f"replication recovery {container_src} {option}", ""
),
Expand Down

0 comments on commit 2530acd

Please sign in to comment.