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

Parallelise and short cut distributor queries. #278

Merged
merged 2 commits into from
Feb 8, 2017
Merged

Conversation

tomwilkie
Copy link
Contributor

Part of #209

Copy link
Contributor

@jml jml left a comment

Choose a reason for hiding this comment

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

Code is definitely cleaner. I'm a bit concerned about the quorum logic being spread out in the code, making it hard to verify.

if len(ingesters) < d.cfg.MinReadSuccesses {
return fmt.Errorf("could only find %d ingesters for query. Need at least %d", len(ingesters), d.cfg.MinReadSuccesses)
// We need a response from a quorum of ingesters, which is n/2 + 1.
minSuccess := (len(ingesters) / 2) + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

By my understanding of the DynamoDB paper, the constraint isn't that quorum is n/2 + 1, but rather that r + w > n, where r is minimum read quorum and w minimum write.

Copy link
Contributor Author

@tomwilkie tomwilkie Feb 8, 2017

Choose a reason for hiding this comment

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

s/DynamoDB/Dynamo/

But yes, that is what the paper says. In our case, we set r = w = n / 2 + 1 (although the +1 is due to integer arithmetic). So r+w > n -> 2r > n -> 2n/2 + 2 > n -> n + 2 > n

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL: "DynamoDB exposes a similar data model and derives its name from Dynamo, but has a different underlying implementation"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, DynamoDB shares virtually no relation to Dynamo, save for name. Consistency and replication model is very different.

}
// Fetch samples from multiple ingesters
var numErrs int32
errs := make(chan error)
Copy link
Contributor

Choose a reason for hiding this comment

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

The routine below is constructed such that this will only ever receive one error, so the name errs is misleading. tooManyErrs? errReceived? maxErr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do.

@@ -527,7 +543,7 @@ func (d *Distributor) forAllIngesters(f func(cortex.IngesterClient) (interface{}
numErrs++
}
}
if numErrs > (d.cfg.ReplicationFactor - d.cfg.MinReadSuccesses) {
if numErrs > 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd have expected this to be zero. Why is one failure OK but two not OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I guess this should really be floor(d.cfg.ReplicationFactor / 2) to keep the invariant above... which for RF=3 is 1. Will make it dynamic.

@tomwilkie
Copy link
Contributor Author

I'm a bit concerned about the quorum logic being spread out in the code, making it hard to verify.

I've made an issue for unifying the query logic ala the schema PR: #279

@tomwilkie tomwilkie merged commit 4a43961 into master Feb 8, 2017
@tomwilkie tomwilkie deleted the short-cut-query branch February 8, 2017 11:23
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