-
Notifications
You must be signed in to change notification settings - Fork 130
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
Prevent CREATE TABLE from using dangling tablespace #876
base: main
Are you sure you want to change the base?
Conversation
When DROP TABLESPACE is running, it's possible to still use the dropping tablespace in CREATE TABLE. It's bad behavior that the table may use a dropped tablespace, which means that data files are stored out of the database. This commit controls creating files in a tablespace and dropping tablespace running in exclusive mode. The key timelines for dropping a tablespace is: 1. Lock tuple of pg_tablespace in AccessExclusive mode. 2. CommitTransaction. 3. Remove directories of the tablespace. 4. Release the lock of the tablespace tuple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
LGTM except two minimal comments.
The lock of tablespace tuple can't handle queries from different database connection. I'll fix it. |
fixed. Lock the shared object instead of database scoped object. |
When DROP TABLESPACE is running, it's possible to still use the dropping tablespace in CREATE TABLE. It's bad behavior that the table may use a dropped tablespace, which means that data files are stored out of the database.
This commit controls creating files in a tablespace and dropping tablespace running in exclusive mode. The key timelines for dropping a tablespace is:
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheck
make -C src/test installcheck-cbdb-parallel
Impact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions