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

[YSQL] Live connection aren't dropped when database is dropped #7119

Closed
ddorian opened this issue Feb 5, 2021 · 3 comments
Closed

[YSQL] Live connection aren't dropped when database is dropped #7119

ddorian opened this issue Feb 5, 2021 · 3 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)

Comments

@ddorian
Copy link
Contributor

ddorian commented Feb 5, 2021

On 2.5.1.0, if I drop a database which has connections to it, the database is dropped but the connections stay orphan.

On PostgreSQL, you can't drop a database with active connections, so this is not possible.

Simple script in python that creates/drops a database in a loop to show connections remaining open:

def schema_test():
    import psycopg2
    index = 0
    pg0 = psycopg2.connect("dbname=yugabyte host=localhost user=yugabyte password=yugabyte port=5433")
    pg0.autocommit = True

    c0 = pg0.cursor()
    while True:
        c0.execute("create database vid_app;")
        pg1 = psycopg2.connect("dbname=vid_app host=localhost user=yugabyte password=yugabyte port=5433")
        pg1.autocommit = True
        c1 = pg1.cursor()
        c1.execute("create table aa(id text primary key);")
        c0.execute("drop database vid_app;")
        pg1.close()
        index += 1
        print(f"index:{index}")
    exit()

schema_test()

You can see processes increasing by running:

ps ax |grep yugabyte
@ddorian ddorian added the area/ysql Yugabyte SQL (YSQL) label Feb 5, 2021
@kmuthukk
Copy link
Collaborator

@ddorian -- would you mind verifying this with 2.5.2?

@ddorian
Copy link
Contributor Author

ddorian commented Feb 26, 2021

@kmuthukk it's fixed on 2.5.2.0. Connections get closed correctly.

@ddorian ddorian closed this as completed Feb 26, 2021
@kmuthukk
Copy link
Collaborator

kmuthukk commented Mar 1, 2021

Related to/duplicate of: #7105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
None yet
Development

No branches or pull requests

3 participants