Skip to content

Improvements to HTTP session #353

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

Merged
merged 7 commits into from
Apr 18, 2018
Merged

Conversation

lutovich
Copy link
Contributor

  • Session#close() terminates ongoing transactions/queries to align with RESET message in Bolt
  • Support for spatial points
  • Support for temporal types. They are exposed as strings, not temporal objects.

@lutovich lutovich requested a review from ali-ince April 13, 2018 17:16
@lutovich lutovich force-pushed the 1.6-http-session-close branch 4 times, most recently from 8bf1a09 to 6b91c51 Compare April 15, 2018 23:04
HTTP driver uses transactional Cypher endpoint instead of Bolt. It used
to simply submit queries via `POST db/data/transaction/commit` in
auto-commit mode. This made it impossible to cancel such queries because
transaction id was not known. Canceling is needed in `Session#close()`
to terminate all ongoing queries and transactions. `Session#close()`
is used by neo4j-browser to terminate running queries.

This commit makes `Session#close()` terminate all ongoing transactions
and thus cancel all running queries. `Session#run()` now does not submit
query directly via `POST db/data/transaction/commit`. Instead, it first
starts a transaction via `POST db/data/transaction` and gets id of the
newly started transaction. Then a query is submitted via
`POST db/data/transaction/XXX` where `XXX` is the transaction id. After
a successful query, separate commit request is issued via
`POST db/data/transaction/XXX/commit`. After a failed query, rollback
is issued via `DELETE db/data/transaction/XXX`.

Transaction id is thus known during the query execution and can be used
by `Session#close()` to rollback the transaction via
`DELETE db/data/transaction/XXX`.
This commit makes experimental HTTP driver able to receive spatial
2D and 3D points and return them as `Point` objects in records. Note
that no metadata is returned by the REST endpoint for nested points
(in lists or maps) so they will not be converted to `Point` objects.
There currently exists no way for the REST endpoint to accept spatial
and temporal types as query parameters. This commit makes driver fail
fast so that given spatial or temporal objects are not misinterpreted
as maps.
All temporal values are exposed as ISO strings, not temporal objects,
as with bolt.
This will rollback all open transactions and cancel running queries.
@lutovich lutovich force-pushed the 1.6-http-session-close branch from 6b91c51 to 91b4e6c Compare April 17, 2018 12:29
@ali-ince ali-ince merged commit 54a0641 into neo4j:1.6 Apr 18, 2018
@lutovich lutovich deleted the 1.6-http-session-close branch April 18, 2018 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants