-
Notifications
You must be signed in to change notification settings - Fork 36
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
Enable Bolt 3.0 and 4.0 #57
Open
majensen
wants to merge
80
commits into
cleishm:main
Choose a base branch
from
majensen:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hey this is a fork
transaction.h transaction.c define tx object that is analogous to result_stream object
* tx object filled out * api-level functions: * neo4j_begin_tx(connection,timeout,mode) * neo4j_run_in_tx(tx, statement, params) - easy, just use result_stream.c functions * neo4j_commit_tx(tx) * neo4j_rollback_tx(tx) * receive callbacks for each of begin, commit, rollback * new NEO4J_TRANSACTION_FAILED errno Some working decisions made on how to store server argvs in tx structure. Leaving as neo4j_* types; getters could convert to strings * Need to destroy tx, presume that should happen under the hood in commit and rollback. If tx is gone, tho, need to communicate final status back to user some other way.
New messages (HELLO, GOODBYE, BEGIN, COMMIT, ROLLBACK) all included at this point. To do: deal with RESET substituting for ACK_FAILURE in 3.0
in ./tests
but it's WIP adhering better to @cleishm's object patterns
to tests; passes.
(if bolt 2, the old arguments are preserved) This gives a successful connection to neo4j:3.5
even if it's empty, for bolt 3+
highlight this as a fork
when version >= 3
catch expired transaction error in run results and update the transaction.
make check passes
WIP - not working yet
Add functioning :begin, :commit, :rollback commands
Manage protocol major and minor versions in protocol negotiation. Attach database name to config object - preserves the neo4j_run API
Most of this has to do with enabling the RUN message to accept 3 arguments (statement, parameters, and the "extra" arg) rather than 2. The extra arg is a neo4j_map that can transmit the desired database name in the "db" key value. A :dbname command is added to the shell. Negotiation is updated to accept v4. bolt v4 is not fully implemented yet.
Several messages (RUN, PULL, DISCARD) have an additional or "extra" map argument in 4.0. This should not be a problem for the machinery of neo4j-client. It is a matter of * creating a map with the required infomation * setting the next available slot in the request _argv[] array to this map * setting the argument count req->argc to the new size of _argv = argv. Such a message queues ok; logging at TRACE level indicates that the arguments are intact. However, when the request comes up for sending (via connection.c:send_requests()) -- that is, when it is pulled off the request queue in the connection object -- the new map is trashed. This is evident via an error from the serializer (called in neo4j_connection_send), that indicates that a map key is not a neo4j_string -- even though that map was successfully printed by the logger in neo4j_session_run(), when the request was created/enqueued. Sample log output against a real running 4.0 server: `` TRACE [connection]: enqu BEGIN (0x7fdcc3e002a0) in 0x7fdcc3d200b0 DEBUG [connection]: sent BEGIN (0x7fdcc3e002a0) in 0x7fdcc3d200b0 DEBUG [connection]: rcvd SUCCESS in response to BEGIN (0x7fdcc3e002a0) TRACE [connection]: enqu RUN{"CREATE (n:booga {thing:1})", {}, {db:"neo4j"}} (0x7fdcc3e00380) in 0x7fdcc3d200b0 TRACE [connection]: enqu PULL {n:-1,qid:-1} (0x7fdcc3e00460) in 0x7fdcc3d200b0 DEBUG [connection]: sent RUN (0x7fdcc3e00380) in 0x7fdcc3d200b0 ERROR [connection]: Error sending message on 0x7fdcc3d200b0: Map contains key of non-String type TRACE [connection]: draining RUN (0x7fdcc3e00380) from queue on 0x7fdcc3d200b0 TRACE [connection]: draining PULL_ALL (0x7fdcc3e00460) from queue on 0x7fdcc3d200b0 Segmentation fault: 11 ``
Now set transation timeout value to 0 to inhibit timeout, set to -1 to fallback to server-side config timeout set.
also, checks work for all versions; leaving version set to 4.
Add slot in shell state object for dbname and manage it there (not config) Remove dbname from config Make dbname a noop for a version 3 server (rather than barfing)
to coincide with Neo4j browser's
in version negotiation - enable all minor versions for v4 and v5 by offering ranges per https://neo4j.com/docs/bolt/current/bolt/handshake/#bolt-version43
add structure based type definitions, constructors, and accessors
update supported versions in negotiation add NEO4J_ELEMENTID type throughout the type system - an element id is treated as a neo4j_string under the hood
with new supported version string
Feat neo4j 5.0 - all tests pass
which causes an obscure error at the server
remove hard-coded supported versions version_spec structure to describe versions config struct contains supported version list protocol negotiation uses config version list
config structure holds version specification array parse simple version string comma-separated list to set add config accessor to set via version string
added options to shell - versions, --support to take a version string to customize client-server handshake
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables a large portion of Bolt protocol versions 3.0 and 4.0. Additional functionality is also added to the shell client to take advantage of explicit transactions (3.0+
:begin
:commit
and:rollback
) and of having multiple databases (4.0+:dbname
).