Skip to content

Return chunks fetched by GetChunks on error#791

Merged
bboreham merged 5 commits intomasterfrom
return-partial-chunk-fetch
Apr 16, 2018
Merged

Return chunks fetched by GetChunks on error#791
bboreham merged 5 commits intomasterfrom
return-partial-chunk-fetch

Conversation

@bboreham
Copy link
Contributor

We will put the chunks fetched so far into the cache, so if the client retries we will probably get a bit further next time.

This change was already made by #605, but it was broken about an hour later by merging #603 which was created before.

@tomwilkie
Copy link
Contributor

Gentle nudge for a unit test perhaps?

So we can run a test where some operations succeed and then subsequent
ones fail.
Some kludging required to (a) make sure it runs only on DynamoDB
and (b) access the error parameters which are on a non-exported type.

Also lots of magic numbers.  It does the job.
If DynamoDB is overloaded, GetChunks() may time out, but we should
return the chunks fetch so they can be put into the cache.  Then if
the client retries we will get a bit further next time.
@bboreham bboreham force-pushed the return-partial-chunk-fetch branch from 52f1cda to 39debda Compare April 13, 2018 16:49
@bboreham
Copy link
Contributor Author

@tomwilkie that was a good nudge - turned out the code I'd written still didn't work.

The groundwork to be able to inject partial errors was rather tortuous, and the test is a bit "carefully crafted", but it does the job.

Bonus: the backoff parameters are now configurable. I only really needed to set them faster so the test would time out in under a minute, but it seemed natural to add command-line options.

func TestChunksPartialError(t *testing.T) {
forAllFixtures(t, func(t *testing.T, client chunk.StorageClient) {
// This test is currently very specialised for DynamoDB
if !strings.Contains(t.Name(), "DynamoDB") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this test belongs in aws package instead then? We already put the dynamodb specific table manager tests there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried. It would need more mechanism to get to the fixture stuff, while avoiding circular dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh well, never mind then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had another go; after 2 hours it's still not passing tests so going to merge this one and post the refactor as a separate PR.

@tomwilkie
Copy link
Contributor

Thanks @bboreham, LGTM! One minor nit.

@bboreham bboreham merged commit b2146f3 into master Apr 16, 2018
@tomwilkie tomwilkie deleted the return-partial-chunk-fetch branch August 29, 2018 15:02
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