-
Notifications
You must be signed in to change notification settings - Fork 60
Master discovery #148
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
Master discovery #148
Conversation
25302d2
to
e3ff285
Compare
c1ba227
to
c1e9131
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like a nice master discovery implementation.
I reviewed the main test file first and internals second, so some questions with "what does this mean" may looks weird.
Most of my comments are just a comments or a questions to clarify something. Since we don't have a well-structured approach to write test, feel free to ignore comments about asserts and not to dig to deep on deciding where we should use Errorf or Fatalt (even though I think it worth to at least replace all Errorf + return with Fatalf's). A couple of comments suggest to change or rework some things. I think it may be discussed separately if it is worth to do them now, later of ignore them.
One more time, thank you for your patch!
f4dd2cc
to
976f1f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a part of review, I will add another comments today
It seems, it'll be hard for me to deeply dive into this pull request in the nearest future. OTOH, I'm interested mostly in high-level design and shared my vision in the RFC. If the implementation is correct and corresponds to the RFC (possibly with a gap to implement in a future), it likely will be okay for me. I asked Georgy to do a decent review. Feel free to proceed after his approve. |
976f1f5
to
d44850b
Compare
d44850b
to
d31ffce
Compare
We strive to use not more than 50 symbols for commit message headline and 72 symbols for commit body lines: https://www.tarantool.io/en/doc/latest/dev_guide/developer_guidelines/#how-to-write-a-commit-message For example, we may drop "automatic" and "connection-pool" headline since it does not adds any new info (and it's not like we have strict commit message style). At least let's try to fit to GitHub restrictions (seeing ellipsis is a bit painful) Or maybe it's better to save the headline and use |
Let's collect the checklist from this PR comments and our live discussions:
To be honest, I'm still doubt that we should use varargs to implement defaults instead of not implementing default at all. Yeah, defaults are cool if they are supported by language (or at least provide lightweight solution like in Lua), but if they require a separate function and variadic args to implement they stop being cool. Have I forgot anything? |
f17cf39
to
d6358d4
Compare
Done. I didn't test every Typed and Async methods, I suppose testing Typed and Async for one request type would be enough. You can find tests for |
And one last thing: there is a separate test target for each folder now Line 24 in dd4f88f
Please, add one |
Regarding this: it seems that there are no noticeable performance drops. At least I couldn't catch them on shallow perf test. So looks like it is okay to leave it like this. |
Also it is possible to add comment to a subpackage See Line 1 in dd4f88f
|
Maybe you're right. And it likely will look bad in the autogenerated docs. I see the following options:
|
e1f2309
to
7d8e478
Compare
Done. |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix some minor doc issues and merge it at last. Great work!
7d8e478
to
571f326
Compare
Main features: - Return available connection from pool according to round-robin strategy. - Automatic master discovery by `mode` parameter. Additional options (configurable via `ConnectWithOpts`): * `CheckTimeout` - time interval to check for connection timeout and try to switch connection `Mode` parameter: * `ANY` (use any instance) - the request can be executed on any instance (master or replica). * `RW` (writeable instance (master)) - the request can only be executed on master. * `RO` (read only instance (replica)) - the request can only be executed on replica. * `PREFER_RO` (prefer read only instance (replica)) - if there is one, otherwise fallback to a writeable one (master). * `PREFER_RW` (prefer write only instance (master)) - if there is one, otherwise fallback to a read only one (replica). Closes #113
571f326
to
9379fb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge it
tarantool/connection_pool
allows users to use multiple connection and process request on replica/master instance according to specified mode.Main features:
mode
parameter.Additional options (configurable via
ConnectWithOpts
):CheckTimeout
- time interval to check for connection timeout and try to switch connectionMode
parameter:ANY
(use any instance) - the request can be executed on any instance (master or replica).RW
(writeable instance (master)) - the request can only be executed on master.RO
(read only instance (replica)) - the request can only be executed on replica.PREFER_RO
(prefer read only instance (replica)) - if there is one, otherwise fallback to a writeable one (master).PREFER_RW
(prefer write only instance (master)) - if there is one, otherwise fallback to a read only one (replica).Example:
To Do: health checks, balancing using weights/distances, anonymous replica
Closes #113