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

DM-14467: Make SqlRegistry more transactional #48

Merged
merged 1 commit into from Jun 1, 2018
Merged

Conversation

pschella
Copy link
Collaborator

No description provided.

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start.

try:
yield
trans.commit()
except Exception:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that this should not be BaseException? If I do a Ctrl-C what happens?

trans = self._connection.begin()
try:
yield
trans.commit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the commit be in a finally block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because we don't want to commit in case an exception is raised.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry. I meant an else block. So that we don't try to run the rollback if the commit itself failed.

- Add transaction context manager.
- Disable DatasetType cache.
- Add _transactional decorator around members that modify state.

Also register DatasetTypes in tests.
@pschella pschella merged commit 018a822 into master Jun 1, 2018
@ktlim ktlim deleted the tickets/DM-14467 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants