-
Notifications
You must be signed in to change notification settings - Fork 19
Add full support for protocol.LAST_COMMIT_INFO (#45) #179
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Seems to handle LastCommitInfo properly.
I don't really understand why threading issues need to be addressed now but not before. But that might be because I never used threading in python so far. So I give that part the benefit of doubt and assume you tested it properly.
@pflynnnuodb Martin is N/A this week so offering this to you for review. |
522e542
to
0dcb97c
Compare
0dcb97c
to
27dcca2
Compare
Previously the LAST_COMMIT_INFO feature was only supported at the protocol level: the driver always reported there was no information available about the last commit. Last commit ensures "read your own writes" capability for committed transactions, even when connections are using different TEs. Implement an internal structure to store last commit information: - The information is saved as a process-wide set of data - Allows the same process to connect to different databases, and to connect to the same database multiple times (to the same or to different TEs). In order to support Python clients that may use threading with different connections, use a Lock() to access the last commit details. Python threading doesn't provide reader/writer locks; rather than write one we'll use a simple mutex and assume this won't be a performance bottleneck. Add a reset() method to forget all information about previously connected databases. This is not required since each database has its own UUID, but can free up resources for long-running applications that connect to lots of different databases.
27dcca2
to
b6b90be
Compare
Previously the LAST_COMMIT_INFO feature was only supported at the protocol level: the driver always reported there was no information available about the last commit.
Last commit ensures "read your own writes" capability for committed transactions, even when connections are using different TEs.
Implement an internal structure to store last commit information:
In order to support Python clients that may use threading with different connections, use a Lock() to access the last commit details. Python threading doesn't provide reader/writer locks; rather than write one we'll use a simple mutex and assume this won't be a performance bottleneck.