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

Transactional client for node-internal use #75

Merged
merged 6 commits into from
Sep 24, 2014

Conversation

spencerkimball
Copy link
Member

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.

Spencer Kimball and others added 4 commits September 22, 2014 13:56
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.
@spencerkimball
Copy link
Member Author

@bdarnell @cockroachdb/developers

@spencerkimball
Copy link
Member Author

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)
Copy link
Member

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?

Copy link
Member Author

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.

spencerkimball added a commit that referenced this pull request Sep 24, 2014
Transactional client for node-internal use
@spencerkimball spencerkimball merged commit 644c98f into master Sep 24, 2014

// Default constants for timeouts.
const (
txnRetryBackoff = 150 * time.Second
Copy link
Contributor

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?

@spencerkimball spencerkimball deleted the spencerkimball/txn-db-impl branch September 29, 2014 19:37
soniabhishek pushed a commit to soniabhishek/cockroach that referenced this pull request Feb 15, 2017
pav-kv pushed a commit to pav-kv/cockroach that referenced this pull request Mar 5, 2024
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.

4 participants