Skip to content

Fix 2 issues with the upload.s3 component#40

Merged
tommyblue merged 2 commits intomainfrom
fix_2_upload_issues
Sep 18, 2020
Merged

Fix 2 issues with the upload.s3 component#40
tommyblue merged 2 commits intomainfrom
fix_2_upload_issues

Conversation

@tommyblue
Copy link
Copy Markdown
Contributor

@tommyblue tommyblue commented Sep 17, 2020

❓ What

  1. upload: s3: add FailOnError config #27 introduced an issue: the
    upload returned too soon and the last file in the logs path wasn't
    uploaded

  2. we found an existing issue that caused an optional last file in the staging
    path not to be uploaded. Changing the topology stop flow, now the uploader waits the upch to be closed, thus correctly running the last upload after the last move (if any)

🔨 How to test

To test this change I used 2 topologies and 3 use cases:

  • one using the KCL input (and input that never ends) that I interrupted with CTRL-c
  • another with the List input reading some s3 files (batch topology), that completed at the end of the input
  • a last one, similar to the above, with a List input reading from S3, but this time I interrupted baker with CTRL-c while it was already uploading a file. In response, the output closed the file, the upload moved it to the staging path and continued to upload both that and the previous one. As those files were very big (>1GB), baker correctly waited the upload to be completed before quitting

✅ Checklists

  • Is there unit/integration test coverage for all new and/or changed functionality added in this PR?
  • Have the changes in this PR been functionally tested?
  • Has make gofmt-write been run on the code?
  • Has make govet been run on the code? Has the code been fixed accordingly to the output?
  • Have the changes been added to the CHANGELOG.md file?
  • Have the steps in CONTRIBUTING.md been followed to update a Go module?

arl
arl previously approved these changes Sep 17, 2020
Copy link
Copy Markdown
Collaborator

@arl arl left a comment

Choose a reason for hiding this comment

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

LGTM

@tommyblue tommyblue force-pushed the fix_2_upload_issues branch 2 times, most recently from 70305f7 to 1001869 Compare September 18, 2020 12:46
@tommyblue tommyblue dismissed arl’s stale review September 18, 2020 12:54

please check new commits

@tommyblue tommyblue force-pushed the fix_2_upload_issues branch 2 times, most recently from 85d051c to a736446 Compare September 18, 2020 13:18
1) #27 introduced an issue: the
upload returned too soon and the last file in the logs path wasn't
uploaded

2) we found an existing issue that caused the last file in the staging
path not to be uploaded. Now the last upload is performed when the
upload channel is closed
Copy link
Copy Markdown
Collaborator

@arl arl left a comment

Choose a reason for hiding this comment

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

LGTM.

At one point we should add some tests very similar to TestS3Upload but use the actual topology rather than emulating it, in order to be closer to the actual production usage, whether baker ends by itself after input exhaustion or because of a CTRL-C

Comment thread upload/s3_test.go Outdated
Comment on lines +126 to +128
stagingDir, rmStagingDir := testutil.TempDir(t)
defer rmStagingDir()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Given that we're now using go1.15, we can directly use https://golang.org/pkg/testing/#T.TempDir

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@arl
Copy link
Copy Markdown
Collaborator

arl commented Sep 18, 2020

@tommyblue you can merge this now if we want to add later the tests I was talking about. In the case we're not doing this in this PR, it would be great to create a ticket for that (in case it hasn't already been created), thanks.

Comment thread upload/s3.go
}
log.WithFields(log.Fields{"filepath": sourceFilePath}).WithError(err).Error("couldn't move")
}
case <-u.quit:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Introduced by #27

@tommyblue tommyblue merged commit dec827a into main Sep 18, 2020
@tommyblue tommyblue deleted the fix_2_upload_issues branch September 18, 2020 15:44
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