Closed stefanak-michal closed 6 months ago
I wrote you a message, here is a copy, which is a reason why I commented two tests.
I've discovered something interesting. When you try to call COMMIT on server in READY state (without opening transaction), it will generate FAILURE response. Which is correct. But RESET can't be send. On older neo4j versions it just does nothing and bolt get stuck on trying to read from empty buffer from db. on newer neo4j version (>=5.12) you get disconnected immediately by neo4j after that failure. You can't even reset, you just have to reconnect. same with rollback
It was confirmed by Neo4j. I will update reading from Bolt on https://github.com/neo4j-php/Bolt/issues/137 but it was suggested to follow server state. Therefore I'm thinking about checking server state in bolt methods in src/Bolt/BoltUnmanagedTransaction.php
.
Don't merge this yet.
okay @transistive , now it's ready. I had to upgrade something in bolt to properly handle server state. https://github.com/neo4j-php/Bolt/pull/139
It's keeping track of open "streams". When you do multiple RUN in open transaction, each one has qid and you have to pull/discard by this qid. But while your transaction is open and you have some not consumed "streams", server state stays in TX_STREAMING. It's explained here https://www.neo4j.com/docs/bolt/current/bolt/message/#transaction in that second example.
Now it is ready for merge.
Most important change is: I've removed calling reset in runStatement and I've added it into assertNoFailure. So for any call which ends in failure is automatically called. I believe that is desired, so the client would be able to recover by itself.