Repository navigation
Implement reconnection strategy class - #109
Conversation
ff0f4af to
46beffb
Compare
|
|
46beffb to
6d62982
Compare
| ''' | ||
| Create a connection to the mesh of Tarantool servers. | ||
|
|
||
| :param str addrs: A map of server hostname or IP-address and a port. |
There was a problem hiding this comment.
The description is a bit unprecise: it is a tuple / a list of maps.
| reconnect_delay=RECONNECT_DELAY, | ||
| connect_now=True, | ||
| encoding=ENCODING_DEFAULT, | ||
| Strategy=RoundRobinStrategy): |
There was a problem hiding this comment.
It is unusual to start a parameter name and / or a class field name from an uppercase letter in Python. From the other side, it is a reference to a class, so I don't sure what is better to do.
| @@ -0,0 +1,23 @@ | |||
| #!/usr/bin/env python | |||
There was a problem hiding this comment.
I don't think we should add and then remove it.
| import time | ||
| import yaml | ||
| from lib.tarantool_server import TarantoolServer | ||
| from tarantool import MeshConnection |
There was a problem hiding this comment.
These imports do not work for me.
| while True: | ||
| try: | ||
| x = con.ping() | ||
| print 'ping Ok' |
There was a problem hiding this comment.
I think it is better to use python-3-style prints, because it is universal.
| @@ -0,0 +1,13 @@ | |||
| #!/usr/bin/env tarantool | |||
| box_cfg_done = false | |||
| [default] | ||
| core = tarantool | ||
| script = master.lua | ||
| description = tarantool/box, replication |
There was a problem hiding this comment.
Description seems to be not about the suite we have here.
6d62982 to
63436b5
Compare
Extend base Connection class to support a list of nodes and an optional Strategy parameter to choose next item from this list. Add built-in reconnect strategy class based on Round-Robin alg. @params: - addrs, list of maps {'host':(HOSTNAME|IP_ADDR), 'port':PORT}. Return next connection or an error if all URIs are unavailable. Closes #106
e6634a3 to
fb256f1
Compare
Totktonada
left a comment
There was a problem hiding this comment.
Comments re testing are below.
I think we can setup CI with make install for now (and merge the PR) and file a follow up issue to use the connector from the repository during make test / cd test && ./test-run.py.
| host, port = addr.split(':') | ||
| addrs.append({'host': host, 'port': int(port)}) | ||
|
|
||
| thread = Thread(target=check_cluster, args=(addrs, )) |
There was a problem hiding this comment.
I think it is better to create purely sequencial test and don't lean on timings. Like so (schematically):
setup instances
setup mesh connection
perform select
stop instance 1
perform select
stop instance 2
start instance 1
perform select
stop instance 1
perform select
fb256f1 to
ca7dc5b
Compare
| local SOCKET_DIR = require('fio').cwd() | ||
|
|
||
| local function instance_uri(instance_id) | ||
| return SOCKET_DIR..'/autobootstrap'..instance_id..'.sock'; |
There was a problem hiding this comment.
Why replica? Why autobootstrap? Why multi?
I think we should adjust naming.
|
I'll ok after:
Also I think we can use default server as the first instance in the test (and setup one more). Please, proceed with that and merge. I don't think I should look into that again. |
ca7dc5b to
436218d
Compare
Extend base Connection class to support a list of nodes and an
optional Strategy parameter to choose next item from this list.
Add built-in reconnect strategy class based on Round-Robin alg.
@params:
Return next connection or an error if all URIs are unavailable.
Closes #106