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

Minor release of v9 with seabolt support? #1599

Closed
ghost opened this issue Apr 8, 2020 · 5 comments
Closed

Minor release of v9 with seabolt support? #1599

ghost opened this issue Apr 8, 2020 · 5 comments

Comments

@ghost
Copy link

ghost commented Apr 8, 2020

I've been experimenting with the seabolt driver on my v9.6 application, it's a bit tricky to set-up, but once done it's fast and reliable -- everything works except one thing: attempting to load the schema results in a Neo4j::Driver::Exceptions::ClientException "Cannot perform data updates in a transaction that has performed schema updates.". Looking at the 9.6.1 source locally, modifying lib/neo4j/tasks/migration.rake from

Neo4j::ActiveBase.run_transaction do
  Neo4j::Migrations::Schema.synchronize_schema_data(...)
  runner = Neo4j::Migrations::Runner.new
  runner.mark_versions_as_complete(schema_data[:versions]) # Run in test mode?
end

to

Neo4j::ActiveBase.run_transaction do
  Neo4j::Migrations::Schema.synchronize_schema_data(...)
end
Neo4j::ActiveBase.run_transaction do
   runner = Neo4j::Migrations::Runner.new
   runner.mark_versions_as_complete(schema_data[:versions]) # Run in test mode?
end

Fixes the issue. I see you have already done the same in master.

So could I request that there is a minor release of the v9 branch (9.6.2?) which back-ports this two-line fix enabling use of Seabolt? I'll be jumping on v10 as soon as it's out of beta, but I'm sure there are those who will be using v9 for some time yet.

@klobuczek
Copy link
Member

Yes, this is probably possible with the right version of neo4j-ruby-driver. @jjg-dressipi could make a PR to the 9.6.x branch with all the changes needed to make it work of if only the changes above could you describe the tricks you had to apply?

@ghost
Copy link
Author

ghost commented Apr 9, 2020

Many thanks, I'll make that PR shortly.

May be best to describe the changes here. This is for a Rails 5 API-only application.

First, you need to have some configuration options set in config/application.rb, and when those are found your config/neo4j.yml is ignored. This means that neo4j.rb will use the default (http) URL and you get errors like "ArgumentError: Invalid URL http://localhost:7474" even though you have specified the bolt protocol and URL in config/neo4j.yml. So move all options defined in config/neo4j.yml into config/application.rb and the per-environment files config/environments/*.rb as follows

Modify config/application.rb to have the extra lines

require 'neo4j/core/cypher_session/adaptors/driver'
require 'neo4j_ruby_driver'
  : 
 module Neo4jUserUser 
    : 
    config.neo4j.session.type = :bolt
    config.neo4j.session.options = {
      ssl: false,
      adaptor_class: Neo4j::Core::CypherSession::Adaptors::Driver
    }

Modify config/environments/test.rb adding the line

config.neo4j.session.url = 'bolt://localhost:7572'

Modify config/environments/development.rb adding the line

config.neo4j.session.url = 'bolt://localhost:7572'

and so on.

@klobuczek
Copy link
Member

@jjg-dressipi neo4j-9.6.2 released!
in your application.rb only adaptor_class is necessary, the other 2 are ignored.
One important thing to find out is which version of neo4j-ruby-driver is compatible with 9.6.2. I can say for sure that the newest 0.4.0 is not. I didn't pay attention to that as so far the driver was supporting only beta versions of activegraph.

@ghost
Copy link
Author

ghost commented Apr 9, 2020

Great -- thanks!

@ghost ghost closed this as completed Apr 9, 2020
@ghost
Copy link
Author

ghost commented Apr 14, 2020

Just a note to confirm that this fixes the issue with my application: my Gemfile now reads

gem 'neo4j', '~> 9.6.2'
gem 'neo4j-ruby-driver', '< 0.4.0'
  : 

which should coerce and maintain the version restrictions mentioned above by @klobuczek

This issue was closed.
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

No branches or pull requests

1 participant