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

ADBDEV-4633: Invalidate diskquota.table_size entries during startup #27

Merged
merged 6 commits into from
Nov 22, 2023

Conversation

RekGRpth
Copy link
Member

@RekGRpth RekGRpth commented Nov 16, 2023

Invalidate diskquota.table_size entries during startup

Diskquota calculates sizes and stores information in the diskquota.table_size
table periodically with a pause in diskquota.naptime, 2 seconds by default.
If we restart the cluster during this pause, then diskquota will lose all
changes that have occurred since the last save to the diskquota.table_size
table. We could create temporary tables, wait when it will be flushed to
diskquota.table_size table, restart the cluster, and diskquota would remember
the information about the temporary tables. Or we could delete the tables,
restart the cluster, and again diskquota will remember information about the
deleted tables. This happens because at the start of the cluster, diskquota
remembers all the information written to the diskquota.table_size table,
but does not check that some tables may have already been deleted.

As a solution, we invalidate diskquota.table_size during diskquota
worker start in addition to pg_class validation.

Diskquota calculates sizes and stores information in the diskquota.table_size
table periodically with a pause in diskquota.naptime, 2 seconds by default.
If we restart the cluster during this pause, then diskquota will lose all
changes that have occurred since the last save to the diskquota.table_size
table. We could create temporary tables, wait when it will be flushed to
diskquota.table_size table, restart the cluster, and diskquota would remember
the information about the temporary tables. Or we could delete the tables,
restart the cluster, and again diskquota will remember information about the
deleted tables. This happens because at the start of the cluster, diskquota
remembers all the information written to the diskquota.table_size table,
but does not check that some tables may have already been deleted.

As a solution, we invalidate diskquota.table_size during diskquota
worker start in addition to pg_class validation.
@RekGRpth RekGRpth marked this pull request as ready for review November 16, 2023 09:19
src/diskquota_utility.c Show resolved Hide resolved
src/diskquota_utility.c Outdated Show resolved Hide resolved
src/quotamodel.c Show resolved Hide resolved
tests/isolation2/sql/test_dropped.sql Outdated Show resolved Hide resolved
KnightMurloc
KnightMurloc previously approved these changes Nov 21, 2023
src/diskquota_utility.c Outdated Show resolved Hide resolved
src/diskquota_utility.c Outdated Show resolved Hide resolved
src/diskquota_utility.c Outdated Show resolved Hide resolved
src/diskquota_utility.c Outdated Show resolved Hide resolved
src/quotamodel.c Show resolved Hide resolved
Copy link

@red1452 red1452 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment: it is better to rename tests to test_temporary_table and test_dropped_table. Because there are not only dropped tables, but there are dropped columns.

@RekGRpth
Copy link
Member Author

One small comment: it is better to rename tests to test_temporary_table and test_dropped_table. Because there are not only dropped tables, but there are dropped columns.

done

@andr-sokolov andr-sokolov merged commit e6899aa into gpdb Nov 22, 2023
3 checks passed
@andr-sokolov andr-sokolov deleted the ADBDEV-4633 branch November 22, 2023 06:42
red1452 added a commit that referenced this pull request Nov 23, 2023
red1452 pushed a commit that referenced this pull request Nov 23, 2023
Diskquota calculates sizes and stores information in the diskquota.table_size
table periodically with a pause in diskquota.naptime, 2 seconds by default.
If we restart the cluster during this pause, then diskquota will lose all
changes that have occurred since the last save to the diskquota.table_size
table. We could create temporary tables, wait when it will be flushed to
diskquota.table_size table, restart the cluster, and diskquota would remember
the information about the temporary tables. Or we could delete the tables,
restart the cluster, and again diskquota will remember information about the
deleted tables. This happens because at the start of the cluster, diskquota
remembers all the information written to the diskquota.table_size table,
but does not check that some tables may have already been deleted.

As a solution, we invalidate diskquota.table_size during diskquota
worker start in addition to pg_class validation.
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.

4 participants