Skip to content

Commit 83c038f

Browse files
craig[bot]fqazi
andcommitted
Merge #154186
154186: catalog/lease: fix a bug preventing timestamp refreshes r=fqazi a=fqazi 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 Fixes: #154124 Release note: None Co-authored-by: Faizan Qazi <[email protected]>
2 parents 39421e6 + 00fcb98 commit 83c038f

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)