Skip to content

[Swift] add simple heuristic to detect incomplete DLOs during read ops - #1710

Merged
RichardScothern merged 1 commit into
distribution:masterfrom
majewsky:swift/wait-for-dlo-segments-during-read
Jul 19, 2016
Merged

RichardScothern merged 1 commit into
distribution:masterfrom
majewsky:swift/wait-for-dlo-segments-during-read

Conversation

@majewsky

@majewsky majewsky commented May 6, 2016 •

Copy link
Copy Markdown
Contributor

This is similar to waitForSegmentsToShowUp (cf. #1650) which is called during Close/Commit. Intuitively, you wouldn't expect missing segments to be a problem during read operations, since the previous Close/Commit confirmed that all segments are there.

But due to the distributed nature of Swift, the read request could be hitting a different storage node of the Swift cluster, where the segments are still missing.

Load tests on my team's staging Swift cluster have shown this to occur about once every 100-200 layer uploads when the Swift proxies are under high load. The retry logic, borrowed from waitForSegmentsToShowUp, allows the Registry to skip past this temporary inconsistency.

Tip: View the diff with ?w=1.

@codecov-io

codecov-io commented May 6, 2016 •

Copy link
Copy Markdown

Current coverage is 52.42%

Merging #1710 into master will decrease coverage by 6.94%

@@             master      #1710   diff @@
==========================================
  Files           120        120          
  Lines         10477      10502    +25   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           6220       5506   -714   
- Misses         3425       4254   +829   
+ Partials        832        742    -90   

Sunburst

Powered by Codecov. Last updated by 4e17ab5...1f03d4e

@majewsky

Copy link
Copy Markdown
Contributor Author

Can we merge this? The patch has been running fine in production in my team's Registry for two weeks now.

@RichardScothern

Copy link
Copy Markdown

This seems fine to me. I'd like someone else with swift knowledge to look at this though @nevermosby @lebauce

@RichardScothern RichardScothern self-assigned this Jun 13, 2016
@RichardScothern RichardScothern added this to the Registry/2.5 milestone Jun 13, 2016
Comment thread registry/storage/driver/swift/swift.go Outdated
return nil, fmt.Errorf("Timeout expired while waiting for segments of %s to show up", path)
}
time.Sleep(waitingTime)
waitingTime += 2

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.

This should have a specific units, based on the default for readAfterWriteWait is this intending

waitingTime += 2 * time.Millisecond

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.

I don't know. I copied the retry logic from waitForSegmentsToShowUp. (I tried to refactor it out into a function, but it became uglier than just copying that small bit.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The logic in waitForSegmentsToShowUp is using waitingTime *= 2 doubling the wait time each time. Maybe the *= was swapped for += by mistake?

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.

Yes, it was. I'll fix this, and rebase the branch on current master while I'm at it.

This is similar to waitForSegmentsToShowUp which is called during
Close/Commit. Intuitively, you wouldn't expect missing segments to be a
problem during read operations, since the previous Close/Commit
confirmed that all segments are there.

But due to the distributed nature of Swift, the read request could be
hitting a different storage node of the Swift cluster, where the
segments are still missing.

Load tests on my team's staging Swift cluster have shown this to occur
about once every 100-200 layer uploads when the Swift proxies are under
high load. The retry logic, borrowed from waitForSegmentsToShowUp, fixes
this temporary inconsistency.

Signed-off-by: Stefan Majewsky <[email protected]>
@majewsky

Copy link
Copy Markdown
Contributor Author

Is this good to go? Would like to have this in 2.5 so that I can switch back to the official images in my prod env.

@RichardScothern

Copy link
Copy Markdown

Code LGTM. The 2.5 release cutoff has already passed. You can use the distribution/registry image once it's merged rather than maintain your own.

@RichardScothern
RichardScothern merged commit f27ceb7 into distribution:master Jul 19, 2016
@majewsky
majewsky deleted the swift/wait-for-dlo-segments-during-read branch July 21, 2016 14:18
cezarsa added a commit to cezarsa/swift that referenced this pull request Aug 22, 2016
This have the same motivations and adds a similar behavior to
distribution/distribution#1710.
@cezarsa cezarsa mentioned this pull request Aug 24, 2016
3 tasks done
@majewsky majewsky mentioned this pull request Nov 6, 2017
6 of 7 tasks
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.

6 participants