create_time_partitions and drop_old_time_partitions with less lock.
DESCRIPTION: PR description that will go into the change log, up to 78 characters from:https://www.postgresql.org/docs/14/sql-createtable.html
Note that creating a partition using PARTITION OF requires taking an ACCESS EXCLUSIVE lock on the parent partitioned table. Likewise, dropping a partition with DROP TABLE requires taking an ACCESS EXCLUSIVE lock on the parent table. It is possible to use ALTER TABLE ATTACH/DETACH PARTITION to perform these operations with a weaker lock, thus reducing interference with concurrent operations on the partitioned table.
@microsoft-github-policy-service agree
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 89.68%. Comparing base (
f424268) to head (7e12c7d). Report is 22 commits behind head on main.
:exclamation: Current head 7e12c7d differs from pull request most recent head 5683a2b. Consider uploading reports for the commit 5683a2b to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #7540 +/- ##
==========================================
- Coverage 89.68% 89.68% -0.01%
==========================================
Files 282 283 +1
Lines 60420 60428 +8
Branches 7523 7525 +2
==========================================
+ Hits 54187 54193 +6
- Misses 4079 4082 +3
+ Partials 2154 2153 -1
Thank you for the contribution. This seems like a really nice improvement. For it to actually do something you have to create the relevant 12.2-1.sql files by copying latest.sql. See here for details: https://github.com/citusdata/citus/blob/main/CONTRIBUTING.md#changing-or-creating-functions
done
Ah, sorry I guess I wasn't clear before. You shouldn't update the old sql files. You should create:
- src/backend/distributed/sql/udfs/create_time_partitions/12.1-1.sql
- src/backend/distributed/sql/udfs/drop_old_time_partitions/12.1-1.sql
And #include those in: src/backend/distributed/sql/citus--12.0-1--12.1-1.sql
And do the reverse includes in: src/backend/distributed/sql/downgrades/citus--12.1-1--12.0-1.sql
I think it's no need to modify downgrades script yes?
I'm sorry, I messed up the version numbers in my previous message. Corrected below:
You shouldn't update the old sql files. You should create:
- src/backend/distributed/sql/udfs/create_time_partitions/12.2-1.sql
- src/backend/distributed/sql/udfs/drop_old_time_partitions/12.2-1.sql
And #include those in: src/backend/distributed/sql/citus--12.1-1--12.2-1.sql
And do the reverse includes in: src/backend/distributed/sql/downgrades/citus--12.2-1--12.1-1.sql
file renamed
You didn't do this part yet:
And
#includethose in: src/backend/distributed/sql/citus--12.1-1--12.2-1.sqlAnd do the reverse includes in: src/backend/distributed/sql/downgrades/citus--12.2-1--12.1-1.sql
And you also need to update the latest.sql files to be the same content as the new 12.2-1.sql files.
Finally, could you undo the removal of the trailing new line in these files. No changes should be necessary to these files at all:
- src/backend/distributed/sql/udfs/create_time_partitions/10.2-1.sql
- src/backend/distributed/sql/udfs/drop_old_time_partitions/12.0-1.sql