Skip to content

Implement creating a unique index concurrently as a DBAction #747

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

Merged
merged 3 commits into from
Mar 31, 2025

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Mar 25, 2025

This PR implements creating unique indexes concurrently as a DBAction. Looking at the implementation of the action, we can refactor it in a later PR and introduce a CreateIndexSQLWriter similar to ConstraintSQLWriter. But this is a problem for a future PR.

@github-actions github-actions bot temporarily deployed to Docs Preview March 25, 2025 13:40 Inactive
@kvch kvch force-pushed the kvch/refactor-create-unique-index branch from 59a7a79 to ecb7182 Compare March 25, 2025 13:43
@github-actions github-actions bot temporarily deployed to Docs Preview March 25, 2025 13:43 Inactive
@kvch kvch requested a review from andrew-farries March 25, 2025 13:46
@kvch kvch mentioned this pull request Mar 25, 2025
15 tasks
if a.schemaName != "" {
quotedQualifiedIndexName = fmt.Sprintf("%s.%s", pq.QuoteIdentifier(a.schemaName), pq.QuoteIdentifier(a.indexName))
}
for retryCount := 0; retryCount < 5; retryCount++ {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can use a range over int statement here instead.

	for range 5 {

@github-actions github-actions bot temporarily deployed to Docs Preview March 26, 2025 16:33 Inactive
@kvch kvch force-pushed the kvch/refactor-create-unique-index branch from d1c6d92 to f03c9dc Compare March 26, 2025 16:34
@github-actions github-actions bot temporarily deployed to Docs Preview March 26, 2025 16:34 Inactive
@kvch kvch requested a review from andrew-farries March 26, 2025 16:36
Copy link
Collaborator

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

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

IIRC, we don't have automated tests to check #485.

It would be worth running through one of the reproductions there to ensure that creating indexes under load is still fixed after this extraction.

@kvch kvch force-pushed the kvch/refactor-create-unique-index branch from f03c9dc to 6140005 Compare March 26, 2025 17:02
@github-actions github-actions bot temporarily deployed to Docs Preview March 26, 2025 17:02 Inactive
@kvch kvch force-pushed the kvch/refactor-create-unique-index branch from 6140005 to 3d40e1e Compare March 31, 2025 13:04
@github-actions github-actions bot temporarily deployed to Docs Preview March 31, 2025 13:04 Inactive
@kvch
Copy link
Contributor Author

kvch commented Mar 31, 2025

I tested the scenario in the issue mentioned. The issue is not coming back when we merge this change.

@kvch kvch merged commit ec662b0 into main Mar 31, 2025
30 checks passed
@kvch kvch deleted the kvch/refactor-create-unique-index branch March 31, 2025 13:14
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