tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Миграция с кастомного коннектора #150

Closed truetug closed 3 years ago

truetug commented 5 years ago

Пользуемся вот такой версией коннектора - tarantool.zip. Она у нас в собственном pypi и всё хорошо. Но поддерживать этот pypi мы больше не можем и хотим в более официальную.

Для этой цели перешли на 'tarantool<0.4', получили две ошибки.

  1. При попытке инсерта
    DatabaseError: (38, u'Supplied key field type does not match index type: expected NUM')
    File "pdd/core/user.py", line 283, in create_user_alias
    alias.insert_to_as_tarantool()
    File "pdd/models/account.py", line 542, in insert_to_as_tarantool
    int(self.utype == self.GROUP),
    File "tarantool/space.py", line 89, in insert
    BOX_RETURN_TUPLE if return_tuple else 0) | BOX_ADD)
    File "tarantool/connection.py", line 291, in _insert
    return self._send_request(request, space_name)
    File "tarantool/connection.py", line 236, in _send_request
    request, space_name, field_defs, default_type)
    File "tarantool/connection.py", line 175, in _send_request_wo_reconnect
    self, header, body, space_name, field_defs, default_type)
    File "tarantool/response.py", line 138, in __init__
    self._unpack_body(body)
    File "tarantool/response.py", line 213, in _unpack_body
    raise DatabaseError(self._return_code, self._return_message)

Данные там например такие: ['somemail@somedomain.ru', 2367682411, 1683321, 'somedomain.ru', 1565605558, 0]

  1. На сервере имеется самописная очередь, при попытке, видимо, забрать таску, получаем такое
    DatabaseError: (51, u"Lua error: ./init.lua:258: attempt to concatenate local 'sno' (a nil value)")
    File "pdd/manage.py", line 26, in <module>
    execute_from_command_line(sys.argv)
    File "django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
    File "django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
    File "django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
    File "statsd/client/timer.py", line 38, in _wrapped
    return f(*args, **kwargs)
    File "pdd/base/management/commands/sync_users.py", line 35, in handle
    for task in self._get_task():
    File "pdd/base/management/commands/sync_users.py", line 69, in _get_task
    task = self.queue.take()
    File "pdd/clients/tntqueue.py", line 70, in take
    self.space, self.tube, timeout
    File "tarantool/connection.py", line 283, in call
    default_type=default_type)
    File "tarantool/connection.py", line 236, in _send_request
    request, space_name, field_defs, default_type)
    File "tarantool/connection.py", line 175, in _send_request_wo_reconnect
    self, header, body, space_name, field_defs, default_type)
    File "tarantool/response.py", line 138, in __init__
    self._unpack_body(body)
    File "tarantool/response.py", line 213, in _unpack_body
    raise DatabaseError(self._return_code, self._return_message)

Ещё раз, в приложенной всё работает как часы. На сервере 1.5, который не обновить.

Вопрос: какой вариант для нас оптимальный: перейти на официальный, что-то поправив у нас/в обертке/пакете или продолжать таскать за собой работающую?

Totktonada commented 5 years ago

First of all, I suggest to raise a question regarding upgrading to at least 1.10 within your team. Older tarantool versions are not supported currently and the situation will be worse and worse as time passes. Sorry, but we don't interested at all in supporting tarantool-1.5.

I unable to investigate the difference in the behavour w/o a test case, but I see that code of your connector looks more like a version before schema reload support, e.g. fe15fc530f24958b5023989796b622ed75899429. Look around git log, maybe you'll find a closer revision. Words 'test case' assumes at least a revision / a package of the connector where you observe a problem, a code on tarantool's side, a request where you get an error.

Another way to look into the problem: let's dump a request msgpack for both connectors on a request of the question.

To be honest I don't see a reason to replace an old working-for-you thing with an old non-working thing. If you have an option to continue use your connector version, then I propose to do it and raise the question to update to 1.10 in background.

Totktonada commented 3 years ago

Feel free to reopen the issue if there are more related questions.