Skip to content

Commit 00fcb98

Browse files
committed
catalog/lease: fix a bug preventing timestamp refreshes
Previously, when we added support for locked leased manager timestamps, which are disabled by default we introduced a new bug that prevented the timestamp from moving forward (even with this feature disabled). To address this, this patch modifies the leased descriptors to allow the timestamps to move forward again. Note: This patch also temporarily skips the flaky test: TestLeaseManagerLockedTimestampBasic Fixes: #153830 Fixes: #153834 Fixes: #153835 Fixes: #154118 Release note: None
1 parent 82a1c7d commit 00fcb98

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/sql/catalog/descs/leased_descriptors.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ func (ld *leasedDescriptors) maybeAssertExternalRowDataTS(desc catalog.Descripto
181181

182182
// maybeInitReadTimestamp selects a read timestamp for the lease manager.
183183
func (ld *leasedDescriptors) maybeInitReadTimestamp(txn deadlineHolder) {
184-
if ld.leaseTimestampSet {
184+
// Refresh the leased timestamp if the read timestamp has changed on us
185+
// or if it hasn't been populated yet.
186+
// TODO (fqazi): For locked read timestamps inside leasing,
187+
// we will need to have extra logic to ensure this is safe.
188+
if ld.leaseTimestampSet &&
189+
ld.leaseTimestamp.GetBaseTimestamp() == txn.ReadTimestamp() {
185190
return
186191
}
187192
readTimestamp := txn.ReadTimestamp()

pkg/sql/catalog/lease/lease_internal_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/cockroachdb/cockroach/pkg/sql/sqlliveness"
3232
"github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/sqllivenesstestutils"
3333
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
34+
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
3435
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
3536
"github.com/cockroachdb/cockroach/pkg/util/admission"
3637
"github.com/cockroachdb/cockroach/pkg/util/ctxgroup"
@@ -1739,6 +1740,8 @@ CREATE TABLE t.test (k CHAR PRIMARY KEY, v CHAR);
17391740
func TestLeaseManagerLockedTimestampBasic(t *testing.T) {
17401741
defer leaktest.AfterTest(t)()
17411742
defer log.Scope(t).Close(t)
1743+
// Skip until future PRs fix this test.
1744+
skip.WithIssue(t, 153826)
17421745

17431746
var blockUpdates atomic.Bool
17441747
var blockCheckPoint atomic.Bool

0 commit comments

Comments
 (0)