Neo4j.jl icon indicating copy to clipboard operation
Neo4j.jl copied to clipboard

To commit/rollback after a read transaction?

Open GearsAD opened this issue 7 years ago • 5 comments

Hi,

I have a quick question: Do you recommend we commit/rollback after read transactions? We just saw that it's required when performing a write, but not sure whether to add the overhead to all read transactions.

We think this might be related to another trend we had noticed where Neo4j could be holding onto many connections, ultimately resulting in new connections being refused when processing many transactions. One guess is that commit on a read closes out the connection.

E.g.

loadtx = transaction(cloudGraph.neo4j.connection)
query = "match (n) return n";
nodes = loadtx(query; submit=true)
# Is this needed for a read, i.e. is the connection left open?
commit(loadtx)  

GearsAD avatar Apr 30 '18 14:04 GearsAD

Hi,

Do you recommend we commit/rollback after read transactions? We just saw that it's required when performing a write, but not sure whether to add the overhead to all read transactions

As you already correctly pointed out, a commit is necessary to close a transaction. The current implementation requires a commit(tx) even though you only send a read transaction. However, a rollback does not have any effect on a read transaction because it does not alter the state of the DB.

We are currently updating the package so that MATCH-queries are done in a single transaction-commit request. I'm currently testing the implementation and it should be available very soon.

I hope that helps, otherwise, let me know if there is anything else :)

Cheers

StefanHaunsberger avatar May 03 '18 09:05 StefanHaunsberger

This seems like an oversight, thanks for taking care of it @StefanHaunsberger !

glesica avatar May 03 '18 23:05 glesica

@GearsAD has your question been addressed? I'm going to add the "enhancement" label to this issue, once you put up a PR would you mind associating it with the issue @StefanHaunsberger ? Thanks!

glesica avatar May 03 '18 23:05 glesica

Hi,

Yes, thanks! We'll change our pattern to make sure all calls end in commits. Appreciate the help, we're pushing the library pretty hard so this really helps.

GearsAD avatar May 04 '18 15:05 GearsAD

@glesica I will

@GearsAD I hope to have the changes up by next week and it should be even a bit faster then as well.

Cheers

StefanHaunsberger avatar May 04 '18 17:05 StefanHaunsberger