Skip to content

Commit

Permalink
Removing warnings and doc notes about sync vs. transactions.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Oct 9, 2020
1 parent 2b4b688 commit 8578324
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 28 deletions.
5 changes: 0 additions & 5 deletions python/lsst/daf/butler/registry/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,6 @@ def syncDimensionData(self, element: Union[DimensionElement, str],
ConflictingDefinitionError
Raised if the record exists in the database (according to primary
key lookup) but is inconsistent with the given one.
Notes
-----
This method cannot be called within transactions, as it needs to be
able to perform its own transaction to be concurrent.
"""
if conform:
if isinstance(element, str):
Expand Down
21 changes: 3 additions & 18 deletions python/lsst/daf/butler/registry/dimensions/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,9 @@ def insert(self, *records: DimensionRecord) -> None:

def sync(self, record: DimensionRecord) -> bool:
# Docstring inherited from DimensionRecordStorage.sync.
inserted = super().sync(record)
if inserted:
try:
with self._db.transaction():
inserted = super().sync(record)
if inserted:
commonSkyPixRows = self._computeCommonSkyPixRows(record)
self._db.insert(self._commonSkyPixOverlapTable, *commonSkyPixRows)
except Exception as err:
# EEK. We've just failed to insert the overlap table rows
# after succesfully inserting the main dimension element table
# row, which means the database is now in a slightly
# inconsistent state.
# Note that we can't use transactions to solve this, because
# Database.sync needs to begin and commit its own transation;
# see also DM-24355.
raise RuntimeError(
f"Failed to add overlap records for {self.element} after "
f"successfully inserting the main row. This means the "
f"database is in an inconsistent state; please manually "
f"remove the row corresponding to data ID "
f"{record.dataId.byName()}."
) from err
return inserted
5 changes: 0 additions & 5 deletions python/lsst/daf/butler/registry/interfaces/_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,6 @@ def sync(self, record: DimensionRecord) -> bool:
sqlalchemy.exc.IntegrityError
Raised if one or more records violate database integrity
constraints.
Notes
-----
This method cannot be called within transactions, as it needs to be
able to perform its own transaction to be concurrent.
"""
raise NotImplementedError()

Expand Down

0 comments on commit 8578324

Please sign in to comment.