cockroachdb / docs

CockroachDB user documentation
https://cockroachlabs.com/docs
Creative Commons Attribution 4.0 International
187 stars 453 forks source link

Read from follower with timestamp bound #2962

Closed jseldess closed 5 years ago

jseldess commented 6 years ago

Background: https://airtable.com/tblD3oZPLJgGhCmch/viw8IfZMg9Up8SP33/rec9oRlKSoHf0yPHv PM: @awoods187 Eng Partner: @spencerkimball

jseldess commented 6 years ago

Follower reads allow non-leaseholder replicas to serve reads under certain conditions that maintain consistency guarantees and stuff.

Estimated scope of docs work:

See also:

nstewart commented 6 years ago

This may be going out in today's alpha but the scope and how to use it are not clear from the airtable record or docs @awoods187

jseldess commented 6 years ago

Based on comments in airtable, the basic framework is in place, but the feature will not be usable in 2.1. Moving the milestone to 2.2. @awoods187, @tschottdorf, please let me know if I'm wrong and we do, in fact, need docs of some sort for 2.1.

tbg commented 6 years ago

You're right, nothing to doc right now.

Kiarahmani commented 6 years ago

Hello Team Cockroach! Sorry to jump in but I am a Ph.D. student at Purdue University avidly waiting for the release of "read-from-follower-replicas" feature*. Following your discussions, my understanding is that it has already been implemented, but you are not planning to make it public yet. If that's the case, can I have a glance at it and maybe get some help on how to use it in a simple setting? Just the syntax and some explanation of what's happening under the hood would suffice.

Really appreciate your time and considerations in advance!

*I am basically developing a program analysis framework which allows database applications to safely avoid long RTTs on a geo-distributed/replicated databases if possible (you can think about it as safe injection of stale reads)

tbg commented 6 years ago

Hi @Kiarahmani, we're a bit heads down polishing the next release right now so I don't have too much time to elaborate, but the bulk of the code lives in pkg/closedts.

To see what's there to use, look at https://github.com/cockroachdb/cockroach/blob/f3ef41665ac5ef35d20faf534e3db5a826801cda/pkg/storage/closed_timestamp_test.go#L36.

But there's no way to use this as a SQL client yet. You would have to hack around in this part of the code to make it such that transactions with timestamps suitably in the past (ba.Txn.Timestamp) are routed to the most desirable replica (instead of the leader). In doing so, you'll be in unchartered, untested, and unsupported territory. Sorry!

jseldess commented 5 years ago

Closing in favor of https://github.com/cockroachdb/docs/issues/3970.