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

kv: fix cluster_logical_timestamp() #41438

Merged

Conversation

andreimatei
Copy link
Contributor

Before this patch, the txn.CommitTimestamp() function (which powers
the cluster_logical_timestamp(), among others) was failing to take into
consideration possible refreshes that might have happened since the
current epoch began (i.e. txn.RefreshedTimestamp).

Fixes #41424

Release note (bug fix): Fix a bug causing the
cluster_logical_timestamp() function to sometimes return incorrect
results.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

:lgtm: nice catch!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei and @nvanbenschoten)


pkg/kv/txn_test.go, line 634 at r1 (raw file):

		commitTS := txn.CommitTimestamp()
		// We expect to have refreshed just after the timestamp injected by the error.
		expTS := refreshTS.Add(0, 1)

The race detector is ok with this, right?

Before this patch, the txn.CommitTimestamp() function (which powers
the cluster_logical_timestamp(), among others) was failing to take into
consideration possible refreshes that might have happened since the
current epoch began (i.e. txn.RefreshedTimestamp).

Fixes cockroachdb#41424

Release note (bug fix): Fix a bug causing the
cluster_logical_timestamp() function to sometimes return incorrect
results.
@andreimatei andreimatei force-pushed the kv.fix-cluster-logical-timestamp branch from f899de6 to b491dde Compare October 8, 2019 19:51
Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @andreimatei)

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)


pkg/kv/txn_test.go, line 634 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

The race detector is ok with this, right?

yup

@craig
Copy link
Contributor

craig bot commented Oct 8, 2019

Build failed (retrying...)

craig bot pushed a commit that referenced this pull request Oct 8, 2019
41323: sql: bevy of fixes for ActiveRecord compatibility r=jordanlewis a=jordanlewis

- improve efficiency of `'foo'::REGCLASS`
- improve efficiency of `pg_get_coldesc`
- parse INTERVAL(6) as a no-op meaning INTERVAL
- bugfix to generate_subscripts for oidvector and int2vector
- add pg_available_extensions
- fix `pg_get_indexdef` and `pg_attrdef.adbin` to be more Postgres compatible

With these fixes, 90% of the fork in `activerecord-cockroachdb-adapter` can go away.

41438: kv: fix cluster_logical_timestamp() r=andreimatei a=andreimatei

Before this patch, the txn.CommitTimestamp() function (which powers
the cluster_logical_timestamp(), among others) was failing to take into
consideration possible refreshes that might have happened since the
current epoch began (i.e. txn.RefreshedTimestamp).

Fixes #41424

Release note (bug fix): Fix a bug causing the
cluster_logical_timestamp() function to sometimes return incorrect
results.

Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Oct 8, 2019

Build succeeded

@craig craig bot merged commit b491dde into cockroachdb:master Oct 8, 2019
craig bot pushed a commit that referenced this pull request Oct 8, 2019
41439: release-19.2: kv: fix cluster_logical_timestamp() r=andreimatei a=andreimatei

Backport 1/1 commits from #41438.

/cc @cockroachdb/release

---

Before this patch, the txn.CommitTimestamp() function (which powers
the cluster_logical_timestamp(), among others) was failing to take into
consideration possible refreshes that might have happened since the
current epoch began (i.e. txn.RefreshedTimestamp).

Fixes #41424

Release note (bug fix): Fix a bug causing the
cluster_logical_timestamp() function to sometimes return incorrect
results.


Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
@andreimatei andreimatei deleted the kv.fix-cluster-logical-timestamp branch October 9, 2019 15:13
craig bot pushed a commit that referenced this pull request Oct 9, 2019
41457: sql: (revert the reversion) fix various problematic uses of the txn in DistSQL flows r=andreimatei a=andreimatei

This is a reversion of #41406, which was a reversion of #41304 

#41304 had been revert because it exposed an existing bug more broadly. That bug was fixed by #41438. So here we go again with this patch.

See individual commits for what the patch does.



Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
craig bot pushed a commit that referenced this pull request Oct 9, 2019
41470: release-19.2: sql: (revert the reversion) fix various problematic uses of the txn in DistSQL flows r=andreimatei a=andreimatei

Backport 4/4 commits from #41457.

/cc @cockroachdb/release

---

This is a reversion of #41406, which was a reversion of #41304 

#41304 had been revert because it exposed an existing bug more broadly. That bug was fixed by #41438. So here we go again with this patch.

See individual commits for what the patch does.




Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
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.

jepsen-monotonic failure when using RootTxn on the gateway
4 participants