Skip to content

Conversation

@Hosshii
Copy link
Member

@Hosshii Hosshii commented Mar 11, 2022

What this PR does / why we need it:
Currently, completedAt does not exists on mysql column, and so order by completedAt will be failed.
To fix this, this PR create generated column of completedAt and add index to it. CompletedAt is nullable.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.48%. This pull request increases coverage by 0.08%.

File Function Base Head Diff
pkg/app/piped/cloudprovider/ecs/task.go FindArtifactVersions -- 100.00% +100.00%
pkg/app/piped/planner/ecs/ecs.go determineVersions -- 0.00% +0.00%
pkg/app/piped/cloudprovider/ecs/task.go parseContainerImage 0.00% 100.00% +100.00%
pkg/app/piped/planner/ecs/ecs.go Planner.Plan 0.00% 0.00% +0.00%


-- index on `CompletedAt` ASC
ALTER TABLE Deployment ADD COLUMN CompletedAt INT(11) GENERATED ALWAYS AS (data->>"$.completed_at") VIRTUAL NULL;
CREATE INDEX deployment_completed_at ON Deployment (CompletedAt);
Copy link
Member

Choose a reason for hiding this comment

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

nits, I don't think we need this index, instead of making this, maybe multiple columns index on CompletedAt and Id column is better, since this CompletedAt column is not be referred independently but in query with other columns. Should use explain query and check it out on MySQL cli.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, I'll check it.

@Hosshii
Copy link
Member Author

Hosshii commented Mar 14, 2022

I fixed it. PTAL.

@khanhtc1202
Copy link
Member

Nice work, thanks 🙌
/approve

@khanhtc1202
Copy link
Member

/approve cancel

ALTER TABLE Deployment ADD COLUMN PipedId VARCHAR(36) GENERATED ALWAYS AS (data->>"$.piped_id") VIRTUAL NOT NULL;
CREATE INDEX deployment_piped_id ON Deployment (PipedId);

-- index on `CompletedAt` DESC
Copy link
Member

Choose a reason for hiding this comment

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

nits, this should be on CompletedAt and Id

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. I updated, PTAL

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.48%. This pull request increases coverage by 0.08%.

File Function Base Head Diff
pkg/app/piped/cloudprovider/ecs/task.go FindArtifactVersions -- 100.00% +100.00%
pkg/app/piped/planner/ecs/ecs.go determineVersions -- 0.00% +0.00%
pkg/app/piped/cloudprovider/ecs/task.go parseContainerImage 0.00% 100.00% +100.00%
pkg/app/piped/planner/ecs/ecs.go Planner.Plan 0.00% 0.00% +0.00%

@khanhtc1202
Copy link
Member

Thanks 🙌
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by khanhtc1202.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants