-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adding bookmarks for cluster support #5
Comments
As far as I understand (since there are no official documentation) bookmarks in V3+ are sent as metadata and for V1+ as parameters. run (
query,
parameters,
{
bookmark,
txConfig,
database,
mode,
beforeKeys,
afterKeys,
beforeError,
afterError,
beforeComplete,
afterComplete,
flush = true
} = {}
) {
const observer = new ResultStreamObserver({
connection: this._connection,
beforeKeys,
afterKeys,
beforeError,
afterError,
beforeComplete,
afterComplete
})
// bookmark and mode are ignored in this version of the protocol
assertTxConfigIsEmpty(txConfig, this._connection, observer)
// passing in a database name on this protocol version throws an error
assertDatabaseIsEmpty(database, this._connection, observer)
this._connection.write(
RequestMessage.run(query, parameters),
observer,
false
)
this._connection.write(RequestMessage.pullAll(), observer, flush)
return observer
} passing bookmarks beginTransaction ({
bookmark,
txConfig,
database,
mode,
beforeError,
afterError,
beforeComplete,
afterComplete
} = {}) {
return this.run(
'BEGIN',
bookmark ? bookmark.asBeginTransactionParameters() : {}, // passing bookmarks as parameters
{
bookmark: bookmark,
txConfig: txConfig,
database,
mode,
beforeError,
afterError,
beforeComplete,
afterComplete,
flush: false
}
)
} It would be helpful if you could add a test case for bookmarks (as I understand they are used only in enterprise?) so it would be easier to test implementation for various versions of the protocol. |
Hi @matas-valuzis it's hard to make a test since the bolt responses doesn't seem to throw any suggestion in of the bookmarks are accepted or not. I think its enterprise only since it only applies to Neo4j clusters. But without it, read after writes are very un-predictive. |
It would be really helpful if the connector would start supporting transaction bookmarks. Now we often have to retry queries due to the fact that the data is not their yet. (read after write).
The bookmark is returned after a write commit. In the
V1/Session.php
run method when the element stats are returned also the bookmark is. It's there in the same elements array.Next comes the setting of the bookmark, I tried adding it to the BEGIN message of a transaction as I saw it was done by the javascript bolt connector but when the bookmark property gets filled an exception on the read is thrown.
Any suggestions on how to add the bookmarks to the next transactions?
The text was updated successfully, but these errors were encountered: