-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Transactional client for node-internal use #75
Conversation
This is essentially the first implementation of a cockroach client, though it's for node-internal use only. It'll be used for range splitting first, and then eventually for message queues, structured data index maintenance, etc. This client uses the kv.KV abstraction to proxy all commands to a wrapped distKV or localKV instance. In the process, the request's Header values are populated to update the commit timestamp and current transaction. Responses are examined to get newest values for commit timestamp and to handle various error conditions which require transaction restart or abort & retry. Added explicit UserPriority to proto.RequestHeader. This allows non-txn commands to specify a user priority. It was necessary to fix a non- deterministic unittest failure but also was something I intended to add eventually anyway.
@bdarnell @cockroachdb/developers |
I'll be working on explicit unittests for all concurrency anomalies. My current list of sources: http://www.telerik.com/help/openaccess-classic/concurrency-control-anomalies.html http://www.postgresql.org/docs/9.1/static/transaction-iso.html http://www.evanjones.ca/db-isolation-semantics.html http://www.cs.umb.edu/~poneil/CCChapter.PDF I think the last one is probably the most comprehensive. I remember seeing a much larger list of concurrency issues though I can't seem to relocate it. |
storage.DB interface. Unfortunately, that was a mistake.
@@ -141,7 +146,7 @@ func (db *DB) Scan(args *proto.ScanRequest) <-chan *proto.ScanResponse { | |||
// services it directly, as creating a new transaction requires only | |||
// access to the node's clock. Nothing must be read or written. | |||
func (db *DB) BeginTransaction(args *proto.BeginTransactionRequest) <-chan *proto.BeginTransactionResponse { | |||
txn := storage.NewTransaction(args.Key, args.UserPriority, args.Isolation, db.coordinator.clock) | |||
txn := storage.NewTransaction(args.Key, args.GetUserPriority(), args.Isolation, db.clock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiousity: Can you set the default for the UserPriority field to one and make it non-nullable or will that not compile/have an actual default of 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't use default values with the non-nullable extension.
Transactional client for node-internal use
|
||
// Default constants for timeouts. | ||
const ( | ||
txnRetryBackoff = 150 * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
150 seconds doesn't look right; did you mean milliseconds?
Feature/select join
update go to patch release 1.19.10
This is essentially the first implementation of a cockroach client, though
it's for node-internal use only. It'll be used for range splitting first,
and then eventually for message queues, structured data index maintenance,
etc.
This client uses the kv.KV abstraction to proxy all commands to a wrapped
distKV or localKV instance. In the process, the request's Header values are
populated to update the commit timestamp and current transaction. Responses
are examined to get newest values for commit timestamp and to handle variou
error conditions which require transaction restart or abort & retry.
Added explicit UserPriority to proto.RequestHeader. This allows non-txn
commands to specify a user priority. It was necessary to fix a non-
deterministic unittest failure but also was something I intended to add
eventually anyway.