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

Support to recursively create partitioned index #86

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

rkrage
Copy link
Contributor

@rkrage rkrage commented Sep 5, 2023

Recurse through sub-partitions when creating a partitioned index

Relies on #94

@rkrage rkrage force-pushed the recursive-partioned-index branch from 711975c to 8fe3505 Compare September 7, 2023 04:25
@rkrage rkrage changed the base branch from partioned-index to safely-acquire-lock-fix September 7, 2023 04:26
@rkrage rkrage force-pushed the recursive-partioned-index branch 2 times, most recently from 6aa9326 to 71af087 Compare September 8, 2023 16:36
@rkrage rkrage changed the title [WIP] Support to recursively create partitioned index Support to recursively create partitioned index Sep 8, 2023
@rkrage rkrage marked this pull request as ready for review September 8, 2023 16:37
lib/pg_ha_migrations/safe_statements.rb Outdated Show resolved Hide resolved
lib/pg_ha_migrations/safe_statements.rb Outdated Show resolved Hide resolved
lib/pg_ha_migrations/safe_statements.rb Outdated Show resolved Hide resolved
lib/pg_ha_migrations/safe_statements.rb Outdated Show resolved Hide resolved
lib/pg_ha_migrations/safe_statements.rb Outdated Show resolved Hide resolved
lib/pg_ha_migrations/safe_statements.rb Outdated Show resolved Hide resolved
spec/safe_statements_spec.rb Outdated Show resolved Hide resolved
spec/safe_statements_spec.rb Outdated Show resolved Hide resolved
@rkrage rkrage force-pushed the safely-acquire-lock-fix branch 3 times, most recently from 3d164e2 to f644f45 Compare September 15, 2023 20:15
Base automatically changed from safely-acquire-lock-fix to master September 15, 2023 20:41
@rkrage rkrage force-pushed the recursive-partioned-index branch from 71af087 to 762281d Compare September 16, 2023 15:03
@rkrage
Copy link
Contributor Author

rkrage commented Sep 16, 2023

I rewrote this to just always recurse because it makes the code infinitely cleaner. I still think there are some edge cases to consider, though. Like currently, we CREATE INDEX ... ON ONLY upfront before recursing through sub-partitions, which I think is safer because it accounts for a situation where child partitions are added while the operation is running, but it also opens us up to a situation where the parent index gets created, the index name on a sub-partition is invalid due to exceeding the 63 byte limit, an error is raised and we're left with an invalid parent index.

I'm still working through these edge cases and writing tests, so this PR can be considered a draft for now.

Update: I think these concerns are resolved by #94

Copy link
Contributor

@jcoleman jcoleman left a comment

Choose a reason for hiding this comment

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

I'm wondering if we want to have a test or two that shows the the invalid indexes left behind in certain error cases.

spec/safe_statements_spec.rb Show resolved Hide resolved
spec/safe_statements_spec.rb Outdated Show resolved Hide resolved
@rkrage rkrage mentioned this pull request Oct 10, 2023
@rkrage rkrage force-pushed the recursive-partioned-index branch from fea29ca to 5d6789d Compare October 10, 2023 20:48
@rkrage rkrage force-pushed the recursive-partioned-index branch from 2f48365 to 531ca35 Compare November 17, 2023 17:36
@rkrage rkrage changed the base branch from master to pin-partman-version November 17, 2023 17:36
Base automatically changed from pin-partman-version to master November 17, 2023 18:19
@rkrage rkrage force-pushed the recursive-partioned-index branch 2 times, most recently from 4557043 to 1993cce Compare November 20, 2023 15:25
@rkrage rkrage force-pushed the recursive-partioned-index branch from 1993cce to ffeaa47 Compare November 21, 2023 17:17
@rkrage rkrage changed the base branch from master to generate-index-names November 21, 2023 17:17
@rkrage rkrage force-pushed the recursive-partioned-index branch from ffeaa47 to 41292e5 Compare November 21, 2023 17:25
Base automatically changed from generate-index-names to master January 11, 2024 16:11
@rkrage rkrage force-pushed the recursive-partioned-index branch from 41292e5 to cd6df2f Compare January 11, 2024 16:14
@rkrage rkrage merged commit 1a82af8 into master Jan 11, 2024
109 checks passed
@rkrage rkrage deleted the recursive-partioned-index branch January 11, 2024 16:54
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.

2 participants