Skip to content
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

System database bookmarks. #619

Merged
merged 4 commits into from
Aug 21, 2019
Merged

System database bookmarks. #619

merged 4 commits into from
Aug 21, 2019

Conversation

zhenlineo
Copy link
Contributor

@zhenlineo zhenlineo commented Jul 26, 2019

Passing system bookmarks to getRT call for bolt v4 connections. The main problem to solve is to find the routing table for a newly created database. When a new database is created, the system database is updated and then the new database is reconciled into existence asynchronously. The system database bookmarks allow us to make a causal link from the created database to the updated routing tables that included it.

System Bookmarks are only used if a routing table update is needed when creating a session. If there is already a valid routing table, then the driver has no problem to route to the specified database in a cluster.

Bookmark is changed from a String to Bookmark object.
Here is the story how this change happened. Session#lastBookmark need to be able to return one or multiple bookmark strings. Normally, if we get a bookmark from server, the bookmark is a single string. However if the bookmark is provided by a user, then the bookmark can be a list of strings. As Session#lastBookmark can be called any time, so the bookmark can be one or multiple bookmark strings. If we simply return a List of strings rather than a Bookmark object, then SessionConfig#withBookmarks has to accept a List of List of string. This API dose not look good. Thus we come to the conclusion to make a bookmark object.

In the driver implementation to support system bookmark, a ConnectionContext is added to carry this system bookmarks down to rediscovery service. It is kind like a SessionConfig but it carries current connection access mode rather than default access mode.

@zhenlineo zhenlineo force-pushed the 2.0-sys-bookmark branch 3 times, most recently from 32628dd to e328d6c Compare July 29, 2019 10:00
For bolt v4, when bookmark is passed into a session, if getRT call is invoked for that session, then the bookmark is passed down to the procedure call.
Changed bookmark to be an object. The content of the object is transparent to driver users.
Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall PR looks good to me, with the exception of exposing bookmarks as a placeholder interface.

@zhenlineo zhenlineo merged commit f609279 into neo4j:2.0 Aug 21, 2019
@zhenlineo zhenlineo deleted the 2.0-sys-bookmark branch August 21, 2019 14:04
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