Skip to content

serverversion.py fails to parse YugabyteDB version #793

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

Closed
FranckPachot opened this issue Aug 2, 2021 · 1 comment
Closed

serverversion.py fails to parse YugabyteDB version #793

FranckPachot opened this issue Aug 2, 2021 · 1 comment

Comments

@FranckPachot
Copy link

FranckPachot commented Aug 2, 2021

  • asyncpg version: EdgeDB server 1.0-beta.2+ga7130d5c7.cv202104290000
  • PostgreSQL version: PostgreSQL 11.2-YB-2.7.1.1-b0 (YugabyteDB)
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : YugabyteDB
  • Python version: 3.9
  • Platform: OL8
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: no
  • If you built asyncpg locally, which version of Cython did you use?: no
  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

YugabyteDB is a PostgreSQL compatible open source distrtibuted database. The format of the version is:

yugabyte=# select version();                                                                                                                          
                                                  version
------------------------------------------------------------------------------------------------------------
 PostgreSQL 11.2-YB-2.7.1.1-b0 on x86_64-pc-linux-gnu, compiled by gcc (Homebrew gcc 5.5.0_4) 5.5.0, 64-bit
(1 row)

This doesn't parse:

    /usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/asyncpg/connection.py, line 86, in __init__
        > serverversion.split_server_version_string(ver_string)
    /usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/asyncpg/serverversion.py, line 50, in split_server_version_string
        > versions = [int(p) for p in parts][:3]
    /usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/asyncpg/serverversion.py, line 50, in <listcomp>
        > versions = [int(p) for p in parts][:3]

ValueError: invalid literal for int() with base 10: '2-YB-2'
Exception ignored in: <function Connection.__del__ at 0x7f695f6c5790>
Traceback (most recent call last):
  File "/usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/asyncpg/connection.py", line 112, in __del__
AttributeError: _source_traceback
ERROR: Could not bootstrap EdgeDB server instance.
[opc@yb0 ~]$

Many distributions change the version text. Maybe better to split on any non-numeric character. Or use current_setting('server_version_num') which is an integer (as suggested in #256 )
Or as a short workaround add:

version_string = version_string.split('-')[0]

to:

version_string = version_string.split(' ')[0]
@elprans
Copy link
Member

elprans commented Aug 2, 2021

Duplicate of #771.

@elprans elprans closed this as completed Aug 2, 2021
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

No branches or pull requests

2 participants