Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recovery: Fix crash of the replica recoverer when adding rules #6597 #6602

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -31,7 +31,7 @@
import rucio.db.sqla.util
from rucio.common.config import config_get_bool
from rucio.common.constants import SuspiciousAvailability
from rucio.common.exception import DatabaseException, VONotFound
from rucio.common.exception import DatabaseException, DuplicateRule, VONotFound
from rucio.common.logging import setup_logging
from rucio.common.types import InternalAccount
from rucio.core.did import get_metadata
Expand Down Expand Up @@ -360,10 +360,13 @@ def run_once(heartbeat_handler: Any, younger_than: int, nattempts: int, vos: Opt
dids_nattempts_1.append(dids)
if active_mode:
if len(dids_nattempts_1) > 0:
add_rule(dids=dids_nattempts_1, account=InternalAccount('root', vo=vo), copies=nattempts, rse_expression='type=SCRATCHDISK', grouping=None, weight=None, lifetime=5 * 24 * 3600, locked=False, subscription_id=None)
logger(logging.INFO, 'Rules have been created for %i replicas on %s.', len(dids_nattempts_1), rse_key)
try:
add_rule(dids=dids_nattempts_1, account=InternalAccount('root', vo=vo), copies=nattempts, rse_expression='type=SCRATCHDISK', grouping=None, weight=None, lifetime=5 * 24 * 3600, locked=False, subscription_id=None)
logger(logging.INFO, 'Rules have been created for %i replicas on %s.', len(dids_nattempts_1), rse_key)
except DuplicateRule:
logger(logging.INFO, 'Tried to create rules on %s, but it already exists.', rse_key)
else:
logger(logging.INFO, 'No rules have been created for replicas on %s.', rse_key)
logger(logging.INFO, 'No replicas on %s have nattmepts=1, so no rules have been created.', rse_key)
if len(files_to_be_declared_bad_nattempts_1) > 0:
logger(logging.INFO, 'Ready to declare %s bad replica(s) with nattempts=1 on %s (RSE id: %s).', len(files_to_be_declared_bad_nattempts_1), rse_key, str(rse_id))
declare_bad_file_replicas(replicas=files_to_be_declared_bad_nattempts_1, reason='Suspicious. Automatic recovery.', issuer=InternalAccount('root', vo=vo), session=None)
Expand Down