fix: do not close the session after constraint drop#3908
Conversation
Trying to use a session after its closure results in an error and cancels the whole database reset. The error would surface after the last constraint drop. `SHOW INDEXES` tries to reuse the session, but `runAutocommit` from the last constraint drop would have closed it. The fix consists in making sure that all queries in `dropSchema` rely on the same open session.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a session management issue occurring during the database reset process. Previously, the use of 'runAutocommit' caused the session to close prematurely, leading to failures in subsequent operations like 'SHOW INDEXES'. The changes ensure that all schema-dropping queries share the same open session, preventing these errors. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the database reset error logging to use a Java text block and replaces runAutocommit with session.run(...).consume() when dropping constraints and indexes. Feedback was provided to correct inconsistent indentation in the new text block to ensure clean log output.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3908 +/- ##
============================================
+ Coverage 55.52% 55.55% +0.02%
- Complexity 6578 6587 +9
============================================
Files 1103 1103
Lines 67634 67649 +15
Branches 7590 7590
============================================
+ Hits 37557 37584 +27
+ Misses 27659 27651 -8
+ Partials 2418 2414 -4
🚀 New features to boost your workflow:
|
Trying to use a session after its closure results in an
error and cancels the whole database reset.
The error would surface after the last constraint drop.
SHOW INDEXEStries to reuse the session, butrunAutocommitfrom the last constraint drop would have closed it.
The fix consists in making sure that all queries in
dropSchemarely on the same open session.