Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
poojashivajikarale
@poojashivajikarale
(n)-[r: Relation]->(n1) where n.name = "abc" and n1.name = "xyz" return r
6 replies
how to do this using activegraph ? Please help
poojashivajikarale
@poojashivajikarale
Or just tell me how to update relationship model?
hng
@hng:matrix.org
[m]
@poojashivajikarale: Did you check the docs out yet? E.g. this part on querying relationships could be relevant: https://neo4jrb.readthedocs.io/en/stable/Relationship.html#query-and-loading-existing-relationships
poojashivajikarale
@poojashivajikarale
Yes I am going through documentation, thanks for the help
OpenCoderX
@OpenCoderX
Can I follow the 10 upgrade guide to upgrade to 11? I have installed neo4j 4.2. https://neo4jrb.readthedocs.io/en/stable/UpgradeGuide.html
OpenCoderX
@OpenCoderX

I'm working on upgrading to the new transaction API. In my existing app and have this pattern for transaction management: ```
begin
tx = Neo4j::Transaction.new(ActiveGraph::Base.current_session)

# business logic here

rescue StandardError => e
add_error(:new_object, :save, "Final save transaction was a failure: #{e}")
tx.failure
ensure
tx.close
end
```

What is the equivalent using the activegraph v10/11 api?

44 replies
hng
@hng:matrix.org
[m]
I think I've fixed the last big problem for the migration of carrierwave-neo4j to activegraph. Would be great if anyone could check it out and test. There are also a few questions I would need feedback from the maintainers. neo4jrb/carrierwave-neo4j#20
Ilya Sterin
@isterin

We're using neo4j 3.5 (hosted version Aura). We're using
gem 'activegraph', '10.0.2'
gem 'neo4j-ruby-driver', '1.7.5'

Pretty frequently we get these exceptions. At times they bring the application down (no request works), other times they are intermittent.
09 Apr 2021 21:07:53.2812021-04-09 21:07:53 +0000 severity=ERROR, #<Neo4j::Driver::Exceptions::SessionExpiredException: code: `fff`, error: `4`, state: `4`, error_context: `secure_openssl_send(/tmp/seabolt/src/seabolt/src/bolt/communication-secure-openssl.c:469), SSL_write error code: 5, underlying error code: 32`>

Any ideas?
Heinrich Klobuczek
@klobuczek
@isterin we have not tested the driver with Aura. Have you tried neo4j 4.0?
Ilya Sterin
@isterin
@klobuczek we have not. Will try today! Thanks.
poojashivajikarale
@poojashivajikarale
Hello, I get this error when I try to read to_node and from_node of a relationship
TypeError (no implicit conversion of Integer into String)
to_node = UpstreamOf.where(service_group: 'telo_logging').first.to_node.to_json
DEPRECATION WARNING: The ActiveGraph::Relationship::Query module has been deprecated and will be removed in a future version of the gem. (called from rescue in irb_binding at (irb):53)
CYPHER
MATCH (n1:ServiceMonitor)-[r1:UPSTREAM_OF]->(n2:ServiceMonitor)
WHERE (r1.service_group = 'telo_logging')
RETURN r1
BOLT: 0ms
CYPHER
MATCH (n)
WHERE (ID(n) = $ID_n)
RETURN n | {:ID_n=>63}
BOLT: 0ms
Traceback (most recent call last):
2: from (irb):52
1: from (irb):53:in `rescue in irb_binding'
TypeError (no implicit conversion of Integer into String)
2 replies
MWK
@oaklodge
@klobuczek
In this repo directory I put the results of my first run at getting those instructions to work. The fix described is because of ruby 3.0.0.
https://github.com/oaklodge/activegraph/tree/master/fixit
Heinrich Klobuczek
@klobuczek
@oaklodge Do you have a proposed way of fixing this so it works in all ruby versions since 2.5?
2 replies
hng
@hng:matrix.org
[m]
@klobuczek: I've (hopefully) finished my PR for updating carrierwave-neo4j to use activegraph neo4jrb/carrierwave-neo4j#20
Duccio
@giovannelli
Hi @klobuczek looking at the doc it seems that activegraph 10.1.0 doesn't support Neo4j 4.1 and 4.2.
But I'm testing an instance of Aura 4.2 and it seems I'm able to connect and queries using neo4j:// and encryption true. Am I missing something? What should I expect using activegraph 10.1.0 and Neo4j 4.2?
Thank you in advance.
3 replies
Wojciech Maciejak
@wmaciejak

Hello @klobuczek, I have question. We implementing in project connection to Neo4j cluster by neo4j:// protocol. We are using neo4j-java-driver in version 4.2.0. Unfortunately when we trying to connect to neo4j and list databases like here:

ActiveGraph::Base.driver.session_orig.run("SHOW DATABASE $db_name", db_name: db_name)

We see error message:

Unable to authenticate request (Neo4j::Driver::Exceptions::SessionExpiredException): Server at IP_ADDRESS:7687 no longer accepts writes

Do you have some idea what we doing wrong?

Heinrich Klobuczek
@klobuczek
@wmaciejak I am not sure what you have overriden with session_orig because that’s not a driver nor activegraph method, but in general the “… no longer accepts writes” error is usually due to the selected server not being a leader at the transaction commit (it might have been at the time it was selected). If you are getting a lot of those errors then the servers might be switching leader very often. This could be related to how your cluster is setup and configured in relation to available resources. Check the logs if the leader switches are actually happening.
Heinrich Klobuczek
@klobuczek
On the other hand SHOW DATABASES does not require write transaction, so you may consider getting a session with default_access_mode READ or use explicit read_transaction.
Wojciech Maciejak
@wmaciejak

You're right @klobuczek. I've forgot to mention about session_orig. But anyway even if I use

ActiveGraph::Base.driver.session(Neo4j::Driver::AccessMode::READ).run("SHOW DATABASE $db_name", db_name: db_name)

I see the same error, what is quite strange cause I'm using READ access mode. I'm using it wrongly?

Heinrich Klobuczek
@klobuczek
yes, the session_config hs been a map since at least driver 4.1
surprised ruby does not catch it def session(**session_config)
It would nice to get this correctly but it doesn’t look like it will solve the problem
maybe it is indeed authentication problem
how many servers do you have in the cluster?
Wojciech Maciejak
@wmaciejak
two followers and one leader
Heinrich Klobuczek
@klobuczek
can you make those queries with the same credentials and db in neo4j browser?
Wojciech Maciejak
@wmaciejak

@klobuczek I've changed my code a bit and useed write_transaction and read_transaction methods.

Now I'm doing something like this

        ActiveGraph::Base.write_transaction do |tx|
          tx.run("CREATE DATABASE $db_name IF NOT EXISTS", db_name: db_name).to_a
        end

So generally it should be fine, but there similar error:

WARNING: Transaction failed and will be retried in 13462ms

2021-05-26T10:44:15.991+02:00    org.neo4j.driver.exceptions.SessionExpiredException: Server at 10.13.201.236:7687 no longer accepts writes

So mine question is - method write_transaction should automatically connect to leader or we have to somehow show which one node is a leader?

Another thing is that my colleague find information that when we working on administrative things like creating db or showing db we should use system db to connect. Do you have idea how to force using system db?

Wojciech Maciejak
@wmaciejak
Okay, I've solved it by passing information to session method and by using session instead of write_transaction :)

Now I created the database and want to perform operation on this database

        ActiveGraph::Base.session(database: "new_db") do |tx|
          tx.run("CALL apoc.import.graphml(\"#{dump_url}\", {batchSize: 20000, readLabels: true})").to_a
        end

but I get error from neo4j:

Unable to authenticate request (Neo4j::Driver::Exceptions::SessionExpiredException): Failed to obtain connection towards WRITE server. Known routing table is: Ttl 1622027172140, currentTime 1622026872142, routers AddressSet=[IP1:7687, IP2:7687, IP3:7687], writers AddressSet=[], readers AddressSet=[IP1:7687], database 'new_db'

Should I somehow reload routing table or just make connection differently?

Heinrich Klobuczek
@klobuczek
Ok, you have a series of issue and misunderstandings. Let’s go through them.
WARNING: Transaction failed and will be retried in 13462ms
this is telling you that most likely the server that was known to the driver as write server is currently not capable to do writes. There is automatic retry in the driver which will execute the entire transcation again with a newly selected server until successfull or some configurable time threshold is exceeded.
Your colleagues are right. You should use a system database for queries like database creation.
Heinrich Klobuczek
@klobuczek
ActiveGraph::Base.session(database: ’system’)
Attention the above returns a session or if called with a block passes that session to the block, not a transaction. Your code only works (or behave differently) because session has a run method as well. However that method is not retryable so you get an error on first attempt.
Heinrich Klobuczek
@klobuczek
The last message tells me that your cluster is not in a healthy state. It looks like a leader has not been elected. Check :sysinfo in neo4j browser to see all databases and server roles.
rfurtad
@rfurtad
Hello, everyone! I'm getting this error when I try to ne44 using url neo4j://my_ip:7687:
could not perform discovery. no routing servers available.
But, if i use bolt://my_ip:7687, it works fine. Does anyone know why this happens?
Daniel Conrad
@danielmconrad
Hey folks! We're looking to upgrade to Neo4j 4.0 or higher from 3.5. We're using neo4j-ruby-driver and plan on upgrading to activegraph from neo4j.rb. I'm having difficulty finding seabolt drivers above 1.7.5. Is our only option to use neo4j-java-driver and run our app on JRuby?
Duccio
@giovannelli
Daniel Conrad
@danielmconrad
@giovannelli I just read the content of the link you posted. It looks like you may have answered my question above.
Duccio
@giovannelli
@danielmconrad I think so!
Daniel Conrad
@danielmconrad
You mentioned there is a plain ruby version of the driver in the 4.2 branch. Is that correct? As in, it doesn't rely on seabolt?
Duccio
@giovannelli
@danielmconrad it shouldn't. I had a quick chat with @klobuczek about it. I started yesterday looking at the code, so I don't have any useful insights yet.
Daniel Conrad
@danielmconrad
That makes sense. Thanks for the info @giovannelli! And I added my upvote :D
Does anyone know what's left outstanding to be production-ready on the 4.2 branch for the plain-ruby driver?
Heinrich Klobuczek
@klobuczek
@danielmconrad the plain ruby driver is about 20-30% ready, so a lot is still missing.