Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
100817: statusccl: fix flaky TestTenantStatusAPI txn_id_resolution r=j82w a=j82w

The txn resolution add a txn id to the cache, and 
then in a separate call updates the txn id with the 
fingerprint. The test previously assumed if there 
was a record it would always have a valid fingerprint, 
but that is not true. The test is modified to add retry 
logic to wait for the fingerprint to be updated. The 
retry time was set to always be 1 minute, because  
SucceedsSoon only waits 5 seconds for race scenario 
which is not enough time for the resolution to complete.

Epic: none
part of: #99770

Release note: none

100943: licenses: Update BSL change date for master/23/2 r=e-mbrown a=e-mbrown

This commit updates the BSL license for master/23.2.

Epic: REL-286
Release note: None

Co-authored-by: j82w <[email protected]>
Co-authored-by: e-mbrown <[email protected]>
  • Loading branch information
3 people committed Apr 10, 2023
3 parents b36c119 + b345206 + 5d1f4bb commit 12548c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions licenses/BSL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Business Source License 1.1
Parameters

Licensor: Cockroach Labs, Inc.
Licensed Work: CockroachDB 23.1
Licensed Work: CockroachDB 23.2
The Licensed Work is (c) 2023 Cockroach Labs, Inc.
Additional Use Grant: You may make use of the Licensed Work, provided that
you may not use the Licensed Work for a Database
Expand All @@ -15,7 +15,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that
Licensed Work by creating tables whose schemas are
controlled by such third parties.

Change Date: 2026-04-01
Change Date: 2026-10-01

Change License: Apache License, Version 2.0

Expand Down
12 changes: 9 additions & 3 deletions pkg/ccl/serverccl/statusccl/tenant_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ func testTxnIDResolutionRPC(ctx context.Context, t *testing.T, helper serverccl.
"expected a valid txnID, but %+v is found", result)
sqlConn.Exec(t, "COMMIT")

testutils.SucceedsSoon(t, func() error {
testutils.SucceedsWithin(t, func() error {
resp, err := status.TxnIDResolution(ctx, &serverpb.TxnIDResolutionRequest{
CoordinatorID: strconv.Itoa(int(coordinatorNodeID)),
TxnIDs: []uuid.UUID{txnID},
Expand All @@ -1220,9 +1220,15 @@ func testTxnIDResolutionRPC(ctx context.Context, t *testing.T, helper serverccl.
require.Equal(t, txnID, resp.ResolvedTxnIDs[0].TxnID,
"expected to find txn %s on coordinator node %d, but it "+
"was not", txnID.String(), coordinatorNodeID)
require.NotEqual(t, appstatspb.InvalidTransactionFingerprintID, resp.ResolvedTxnIDs[0].TxnFingerprintID)

// It's possible that adding the transaction id to the cache and
// updating the transaction id with a valid fingerprint are done in
// 2 separate batches. This allows retries to wait for a valid fingerprint
if appstatspb.InvalidTransactionFingerprintID == resp.ResolvedTxnIDs[0].TxnFingerprintID {
return fmt.Errorf("transaction fingerprint id not updated yet. TxnFingerprintID: %d", resp.ResolvedTxnIDs[0].TxnFingerprintID)
}
return nil
})
}, 1*time.Minute)
}

t.Run("regular_cluster", func(t *testing.T) {
Expand Down

0 comments on commit 12548c5

Please sign in to comment.