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

Queue artifacts table, phase 2, step 2 #3152

Merged
merged 2 commits into from Jul 14, 2020

Conversation

helfi92
Copy link
Contributor

@helfi92 helfi92 commented Jul 3, 2020

No description provided.

@helfi92 helfi92 force-pushed the port_queue_artifacts_step_2 branch 2 times, most recently from 2492292 to 6abfb25 Compare July 6, 2020 20:57
@helfi92 helfi92 marked this pull request as ready for review July 6, 2020 21:01
@helfi92 helfi92 requested a review from a team as a code owner July 6, 2020 21:01
Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

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

Looking good aside from the notes here.

@@ -229,3 +229,152 @@ methods:
end;
end if;
end
delete_queue_artifact:
Copy link
Collaborator

Choose a reason for hiding this comment

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

You'll need to move these to a new DB version, since they'll land in a later release than step 1.


const fetchResults = async (continuation) => {
const query = continuation ? { continuationToken: continuation } : {};
const {continuationToken, rows} = await paginateResults({
Copy link
Collaborator

Choose a reason for hiding this comment

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

paginateResults is for APIs.. it's just abstracting over the pagination in a way that obscures what's really happening here. I think this function could just loop with adjustments to page_offset on each iteration, until it gets zero results.

*/
async expire({ db, publicBucket, privateBucket, ignoreError, monitor, expires }) {
let count = 0;
await exports.artifactUtils.getExpiredArtifacts(db, expires, async (artifact) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be the only use of getExpiredArtifacts, so perhaps that utility could be combined here, or incorporated as a nested function?

I think this is going to miss expiring artifacts:

  • call get_queue_artifacts with a page size of 1000
  • call S3 for each of those 1000
  • call delete_artifact for each of those 1000
  • call get_queue_artifacts with a page size of 1000, offset 1000

..at this point, we've missed 1000 expired artifacts since the offset skips 1000 non-deleted artifacts.

This actually isn't the end of the world -- those artifacts would hopefully just get picked up in the next run of the expiration job -- but might be confusing when we wonder why there's a small tail of expired artifacts in the DB.

I suspect the fix would be to decrement the offset by 1 for every call to delete_queue_artifact. In the success case, that will end up calling get_queue_artifacts with offset = 0 every time, until it returns no results, but in the failure case it will not re-try deleting S3 objects.

Separately, it seems like we should be taking a closer look at these errors instead of just ignoring them. I'll file a followup for that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(#3183)

artifact.taskId, artifact.runId, artifact.name, details,
expires, artifact.etag
)
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this passes etag, it should handle conflicts. I'm not sure it needs to handle the etag, though? I think this is just for idempotency so we can assume that this call will override a previous call.

And, with that change, you can drop etag support for update_queue_artifact, which simplifies its implementation quite a bit.

@helfi92 helfi92 requested a review from djmitche July 9, 2020 14:19
@helfi92 helfi92 force-pushed the port_queue_artifacts_step_2 branch from bdea363 to 97f03f0 Compare July 9, 2020 14:20
@helfi92 helfi92 removed the request for review from djmitche July 9, 2020 15:22
@helfi92 helfi92 force-pushed the port_queue_artifacts_step_2 branch from 97f03f0 to d0f0b0e Compare July 10, 2020 12:51
@helfi92 helfi92 requested a review from djmitche July 10, 2020 18:04
Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

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

This hit all the points in my last review :)

services/queue/src/utils.js Show resolved Hide resolved
@helfi92 helfi92 force-pushed the port_queue_artifacts_step_2 branch from d0f0b0e to e8a5986 Compare July 14, 2020 16:04
@helfi92 helfi92 merged commit c5b448a into taskcluster:master Jul 14, 2020
@helfi92 helfi92 deleted the port_queue_artifacts_step_2 branch July 14, 2020 18:08
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.

None yet

2 participants