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

GODRIVER-1806 Fix and test DownloadStream.Skip() #557

Merged
merged 4 commits into from
Jan 14, 2021

Conversation

kevinAlbs
Copy link
Contributor

  • Fix bug when skip lands on chunk boundary

- Fix bug when skip lands on chunk boundary
@kevinAlbs kevinAlbs changed the title GODRIVER-1806 fix and test DownloadStream.Skip() GODRIVER-1806 Fix and test DownloadStream.Skip() Jan 5, 2021
@kevinAlbs
Copy link
Contributor Author

I believe the test failures of TestPool tasks on 2.6 Ubuntu 14.04 are unrelated. I also see them on #556.

@@ -193,29 +193,26 @@ func (ds *DownloadStream) Skip(skip int64) (int64, error) {
var err error

for skipped < skip {
if ds.bufferStart == 0 {
if ds.bufferStart >= ds.bufferEnd {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This now more closely follows the logic of Read.

@kevinAlbs kevinAlbs marked this pull request as ready for review January 5, 2021 15:54
"read 0, skip 0", 0, 0, 0, nil, "abc.def.ghi",
},
{
"read 0, skip to end of chunk", 0, 4, 4, nil, "def.ghi",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests problem 2 described in the ticket.

"read 0, skip 1", 0, 1, 1, nil, "bc.def.ghi",
},
{
"read 1, skip to end of chunk", 1, 3, 3, nil, "def.ghi",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests problem 1 described in the ticket.

mongo/integration/gridfs_test.go Outdated Show resolved Hide resolved
mongo/integration/gridfs_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@divjotarora divjotarora left a comment

Choose a reason for hiding this comment

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

Looks great! Just a few small comments on tests.

mongo/integration/gridfs_test.go Outdated Show resolved Hide resolved
mongo/integration/gridfs_test.go Outdated Show resolved Hide resolved
mongo/integration/gridfs_test.go Outdated Show resolved Hide resolved
@kevinAlbs kevinAlbs merged commit cc85d32 into mongodb:master Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants