Skip to content

fix: do not close the session after constraint drop#3908

Merged
Abacn merged 2 commits into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/session_misuse
Jun 11, 2026
Merged

fix: do not close the session after constraint drop#3908
Abacn merged 2 commits into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/session_misuse

Conversation

@fbiville

Copy link
Copy Markdown
Collaborator

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.

fbiville added 2 commits June 11, 2026 15:15
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.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Session Management: Replaced the use of 'runAutocommit' with direct session execution during schema dropping to prevent premature session closure.
  • Error Handling: Updated the database reset error message to provide clearer instructions on required permissions and fallback operations.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.55%. Comparing base (6ff0c8a) to head (2593b74).
⚠️ Report is 4 commits behind head on main.

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     
Components Coverage Δ
spanner-templates 88.49% <ø> (+0.16%) ⬆️
spanner-import-export 68.53% <ø> (-0.13%) ⬇️
spanner-live-forward-migration 90.24% <ø> (+0.01%) ⬆️
spanner-live-reverse-replication 84.44% <ø> (+0.43%) ⬆️
spanner-bulk-migration 92.63% <ø> (+<0.01%) ⬆️
gcs-spanner-dv 88.90% <ø> (-0.11%) ⬇️
Files with missing lines Coverage Δ
...ud/teleport/v2/neo4j/database/Neo4jConnection.java 75.22% <100.00%> (+0.90%) ⬆️

... and 16 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Abacn Abacn merged commit ac1967e into GoogleCloudPlatform:main Jun 11, 2026
20 of 22 checks passed
@fbiville fbiville deleted the neo4j/session_misuse branch June 12, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants