-
Notifications
You must be signed in to change notification settings - Fork 970
fix: Use managed read transactions for queries in metadata service #2119
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
fix: Use managed read transactions for queries in metadata service #2119
Conversation
Signed-off-by: Kristen Armes <[email protected]>
if LOGGER.isEnabledFor(logging.DEBUG): | ||
LOGGER.debug('Executing Cypher query: {statement} with params {params}: '.format(statement=statement, | ||
params=param_dict)) | ||
start = time.time() | ||
try: | ||
with self._driver.session(database=self._database_name) as session: | ||
result = session.run(query=statement, **param_dict) | ||
return [record for record in result] | ||
return session.read_transaction(execute_statement, statement, param_dict) |
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.
can we make the return the same on the execute_statement
function. So rather than doing .data()
doing [record for record in result]
. I am not sure if using .data() could cause a mismatch in the expected returned data type.
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.
yes this is a good point, I was having trouble getting the results originally so I thought it needed to be done a different way, but turns out I was just doing it in the wrong spot. just updated this so the original return way is used, but just in the transaction function instead of here
Signed-off-by: Kristen Armes <[email protected]>
…mundsen-io#2119) * Use managed read transactions for queries in metadata service Signed-off-by: Kristen Armes <[email protected]> * Return same type as before Signed-off-by: Kristen Armes <[email protected]> --------- Signed-off-by: Kristen Armes <[email protected]> Signed-off-by: Ben Dye <[email protected]>
…mundsen-io#2119) * Use managed read transactions for queries in metadata service Signed-off-by: Kristen Armes <[email protected]> * Return same type as before Signed-off-by: Kristen Armes <[email protected]> --------- Signed-off-by: Kristen Armes <[email protected]>
Description
Updating metadata GET APIs to use managed read transactions in the Neo4j proxy to provide retry capabilities.
Motivation and Context
We were having an issue with errors with our health check where our Neo4j instance was showing that our client connection was closing, so trying this out to see if it fixes the issue. In any case, it is the Neo4j recommended way of executing transactions.
How Has This Been Tested?
Documentation
N/A
CheckList