Skip to content

Commit

Permalink
Merge pull request rucio#1819 from bari12/patch-1772-Merge_Bug_in_Con…
Browse files Browse the repository at this point in the history
…tentsHistory_crashes_undertaker

Core: Removed merge commit as it does not work for history tables; Fix rucio#1772
  • Loading branch information
bari12 committed Nov 26, 2018
2 parents 522b36a + fb25381 commit 253ea2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/rucio/core/did.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# Authors:
# - Vincent Garonne <vgaronne@gmail.com>, 2013-2018
# - Martin Barisits <martin.barisits@cern.ch>, 2013-2017
# - Martin Barisits <martin.barisits@cern.ch>, 2013-2018
# - Cedric Serfon <cedric.serfon@cern.ch>, 2013-2018
# - Ralph Vigne <ralph.vigne@cern.ch>, 2013
# - Mario Lassnig <mario.lassnig@cern.ch>, 2013-2018
Expand Down Expand Up @@ -728,7 +728,6 @@ def detach_dids(scope, name, dids, session=None):
created_at=associ_did.created_at,
updated_at=associ_did.updated_at,
deleted_at=datetime.utcnow())
new_detach = session.merge(new_detach)
new_detach.save(session=session, flush=False)

# Send message for AMI. To be removed in the future when they use the DETACH messages
Expand Down Expand Up @@ -864,9 +863,11 @@ def list_content_history(scope, name, session=None):
:param session: The database session in use.
"""
try:
# query = session.query(models.DataIdentifierAssociationHistory).\
# with_hint(models.DataIdentifierAssociationHistory,
# "INDEX(CONTENTS_HISTORY CONTENTS_HIST_PK)", 'oracle').\
# filter_by(scope=scope, name=name)
query = session.query(models.DataIdentifierAssociationHistory).\
with_hint(models.DataIdentifierAssociationHistory,
"INDEX(CONTENTS_HISTORY CONTENTS_HIST_PK)", 'oracle').\
filter_by(scope=scope, name=name)
for tmp_did in query.yield_per(5):
yield {'scope': tmp_did.child_scope, 'name': tmp_did.child_name,
Expand Down
7 changes: 5 additions & 2 deletions lib/rucio/db/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,11 @@ class DataIdentifierAssociationHistory(BASE, ModelBase):
rule_evaluation = Column(Boolean(name='CONTENTS_HIST_RULE_EVAL_CHK'))
did_created_at = Column(DateTime)
deleted_at = Column(DateTime)
_table_args = (PrimaryKeyConstraint('scope', 'name', 'child_scope', 'child_name', name='CONTENTS_HIST_PK'),
CheckConstraint('DID_TYPE IS NOT NULL', name='CONTENTS_HIST_DID_TYPE_NN'),
__mapper_args__ = {
'primary_key': [scope, name, child_scope, child_name]
}
# _table_args = (PrimaryKeyConstraint('scope', 'name', 'child_scope', 'child_name', name='CONTENTS_HIST_PK'),
_table_args = (CheckConstraint('DID_TYPE IS NOT NULL', name='CONTENTS_HIST_DID_TYPE_NN'),
CheckConstraint('CHILD_TYPE IS NOT NULL', name='CONTENTS_HIST_CHILD_TYPE_NN'),
Index('CONTENTS_HISTORY_IDX', 'scope', 'name'))

Expand Down

0 comments on commit 253ea2b

Please sign in to comment.