Skip to content

Commit 216f7ae

Browse files
sql/catalog: address panic inside maybeReleaseReadTimestamp (#167956)
sql/catalog: address panic inside maybeReleaseReadTimestamp
2 parents 839d4a5 + 4cc8a37 commit 216f7ae

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

pkg/sql/catalog/descs/leased_descriptors.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,17 @@ func (ld *leasedDescriptors) maybeInitReadTimestamp(ctx context.Context, txn dea
297297
return ld.maybeAdvanceReadTimestamp(ctx, txn)
298298
}
299299
readTimestamp := txn.ReadTimestamp()
300-
ld.leaseTimestampSet = true
300+
setTimestamp := func(ts lease.ReadTimestamp) {
301+
ld.leaseTimestamp = ts
302+
ld.leaseTimestampSet = true
303+
}
301304
// Fixed timestamp queries will use descriptors at the user-selected timestamp.
302305
if txn.ReadTimestampFixed() {
303-
ld.leaseTimestamp = lease.TimestampToReadTimestamp(readTimestamp)
306+
setTimestamp(lease.TimestampToReadTimestamp(readTimestamp))
304307
return nil
305308
}
306309
// Otherwise, get a safe read timestamp from the lease manager.
307-
ld.leaseTimestamp = ld.lm.GetReadTimestamp(ctx, readTimestamp)
310+
setTimestamp(ld.lm.GetReadTimestamp(ctx, readTimestamp))
308311
return nil
309312
}
310313

0 commit comments

Comments
 (0)