Skip to content

fix: DDL locking session hanging (#90)#297

Open
imranzaheer612 wants to merge 1 commit intoaws:mainfrom
imranzaheer612:ddl-lock
Open

fix: DDL locking session hanging (#90)#297
imranzaheer612 wants to merge 1 commit intoaws:mainfrom
imranzaheer612:ddl-lock

Conversation

@imranzaheer612
Copy link
Contributor

Unlock the relation if locked by toplevel transaction and a queued DDL command waiting to be replayed.

Issue #90,

As described in the issue if we try to insert in the same table which is going to be drooped by the Node 1. The insert command will apply a lock on the table, as the result when Node 2 will try to replay (dropping the same rel) it will not and will go under a race condition.

I tried unlocking the relation and then locking it again after the DDL is replayed. It worked. But I am not sure weather unlocking a relation which was locked by the toptransaction is safe or not. So let me know if the approach looks OK to you. Thanks

Present behavior.

Node 1:

app=# begin;
BEGIN
app=*# drop table foo;
DROP TABLE

Node 2:

app=# insert into foo values (1);

Hanging.

Node 1:

app=*# commit;
COMMIT

Node 2

app=# insert into foo values (1);
ERROR:  relation 34120 deleted while still in use

Unlock the relation if locked by toplevel transaction and a queued DDL command waiting to be executed.
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

Successfully merging this pull request may close these issues.

1 participant