Code Monkey home page Code Monkey logo

Comments (21)

florinpatrascu avatar florinpatrascu commented on June 27, 2024 1

Hi there - thank you for this report, I'll check again that part. What version of Neo4j, are you using for the tests?

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024 1

code is in the master, and is was just published to hex.pm moments ago

Thanks again, Paul!

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

2.3.2 Community

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

hmm, ok, I'll try that; I am using 3

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

I'll try updating to 3.x myself and see if that changes anything.

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

not sure if that would change anything?! The issue you found probably has nothing to do with the Neo4j.

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

Just tried with 3.0.3 and the same tests fail in the same way. I'm kinda HOPING it's just a problem with Neo4j.Sips, only because that would be a lot easier to fix. ;)

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

:) Now I need a reliable test, to make sure I can reproduce the issue you found.

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

Try the code in my fork? :)

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

sure, looking at https://github.com/dotdotdotpaul/neo4j_sips/blob/master/test/neo4j_sips_transaction_test.exs

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

That's the one. :)

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

This: "commit statements in an open transaction", is the one failing, right?!

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

Actually, they both fail at this point, at the point where I'm testing that the change made in the transaction is NOT visible to the "main connection" until the transaction is committed...

pclegg:~/work/neo4j_sips (master)$ mix test
test/neo4j_sips_transaction_test.exs:75: warning: variable results is unused
.....

  1) test rollback statements in an open transaction (Neo4j.Sips.Transaction.Test)
     test/neo4j_sips_transaction_test.exs:29
     Main connection should not be able to see transactional change
     stacktrace:
       test/neo4j_sips_transaction_test.exs:44



  2) test commit statements in an open transaction (Neo4j.Sips.Transaction.Test)
     test/neo4j_sips_transaction_test.exs:59
     Main connection should not be able to see transactional change
     stacktrace:
       test/neo4j_sips_transaction_test.exs:71

.......

Finished in 0.9 seconds (0.1s on load, 0.7s on tests)
14 tests, 2 failures

Randomized with seed 447555

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

I only imported the test/neo4j_sips_transaction_test.exs and didn't start changing my original code yet, I only have one test failing ATM, the one I mentioned above.

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

Oh, cool. That's a good sign. Maybe I flubbed something up in trying to fix that "invalid query" error when calling tx_commit(conn)... (which is what that failing test is testing).

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

This is what I have, so far:

~/alchemy_lab/neo4j_sips $ mix test test/neo4j_sips_transaction_test.exs 
test/neo4j_sips_transaction_test.exs:75: warning: variable results is unused
..

  1) test commit statements in an open transaction (Neo4j.Sips.Transaction.Test)
     test/neo4j_sips_transaction_test.exs:59
     Assertion with == failed
     code: Enum.count(results) == 1
     lhs:  0
     rhs:  1
     stacktrace:
       test/neo4j_sips_transaction_test.exs:80



Finished in 0.1 seconds (0.1s on load, 0.04s on tests)
3 tests, 1 failure 

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

Cool. I suspect the ultimate call to tx_commit(conn, "") is failing because the empty string is an invalid query. So when that actually gets called, the failure of the "empty string query" actually results in a rollback.

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

Elixir 1.2.6?

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

1.2.5, but hopefully that doesn't change much.

from neo4j_sips.

florinpatrascu avatar florinpatrascu commented on June 27, 2024

nailed it. Please pull the code from the tx_debug branch, it should work now. You suspected the driver and the server too, and you were right :) On my side, I had a design issue. The Query will "auto-commit" any query executed in an open transaction. Neo4j also has a "specific" behaviour that I was not aware of; the docs are not exactly clear sometimes. Committing an open transaction with no params, must be treated a bit different otherwise Neo4j will simply not commit :( In my case, when committing a Tx i.e. Neo4j.tx_commit(conn), the driver will send an empty statement to the server:

{
  "statements" : [ ]
}

and the server will basically not commit(close) the open transaction. Tricky to debug, but I found it.

Please have a look and check if your tests are passing now, I'll clean up the (Query) code tomorrow and merge the code to master. Taking a break now, and thanks so much for your findings. BTW, pls send any PR if need be, and I'll merge asap. Using your Tx tests from now on ;)

Cheers!

from neo4j_sips.

dotdotdotpaul avatar dotdotdotpaul commented on June 27, 2024

Whew, that's pretty crazy, glad I could help. If you've already pulled my Tx tests in, probably no need for a pull request at this point! ;)

from neo4j_sips.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.