-
Notifications
You must be signed in to change notification settings - Fork 71
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
streams.sink.start() has no effect unless results are iterated #465
Comments
It is worth noting that |
@ivangreene we are investigating this. We think this may be a limitation in the semantics/operation of executeTransactionally, but are not yet sure. Will follow up. |
Underlying implementation is here: neo4j-streams/consumer/src/main/kotlin/streams/procedures/StreamsSinkProcedures.kt Line 50 in 8f986d6
Kernel team has indicated that consumption or non-consumption of the results should not affect whether the TX executes or not. |
@moxious It makes sense that executeTransactionally should not consume an entire stream if all of the results are not needed, although that behavior may have surprises like this. I wish I understood Kotlin so I could open a PR, but I don't know how to move the call to 'start' outside of the stream operation 😄 |
@ivangreene starting the sink indeed does have different threading consequences, which is a conflating factor here, but you can't really move that call outside of the path. Otherwise if starting the consumption service failed (for whatever reason) it would be impossible to be notified of that in the return of the proc. Moving it outside would make the proc blind to the success or failure of the call, and would make the status returned not meaningful |
This will likely require us to repro and do some investigation. Good enough for the moment that the work-around is so trivial (just consume the results) |
Hmm... so you need some way to call start() immediately, but also return an error in the result Stream if the call to start() fails. Yep I have no idea how to do this in Kotlin 😄 . Ok well thanks for the attention to the issue, and let me know if you have any problems reproducing it |
Expected Behavior (Mandatory)
Calling
streams.sink.start()
should start the sink, regardless of whether the results are iteratedActual Behavior (Mandatory)
The sink is not started unless the results are iterated
How to Reproduce the Problem
Steps (Mandatory)
streams.sink.start
from within another procedure, using GraphDatabaseService#executeTransactionally:This appears to be due to the procedure returning a Stream where the start call only occurs inside of a stream stage, which gets skipped if the stream is not consumed: https://github.com/neo4j-contrib/neo4j-streams/blob/3.5/consumer/src/main/kotlin/streams/procedures/StreamsSinkProcedures.kt#L50-L62
I don't really know Kotlin but I was able to decompile it to Java to see this:
Specifications (Mandatory)
Currently used versions
Versions
The text was updated successfully, but these errors were encountered: