Skip to content

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 kevinAlbs force-pushed the gridfs.GODRIVER-1806 branch from e8163d5 to 4787346 Compare January 5, 2021 05:50
@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
@kevinAlbs kevinAlbs requested review from iwysiu and benjirewis January 5, 2021 15:55
"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.

@kevinAlbs kevinAlbs requested a review from benjirewis January 7, 2021 17:28
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.

@kevinAlbs kevinAlbs requested a review from divjotarora January 7, 2021 18:37
@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
Development

Successfully merging this pull request may close these issues.

4 participants