forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
113934: roachprod: use gcloud CLI instead of net.LookupSRV r=renatolabs a=herkolategan Previously `net.LookupSRV` with a custom resolver was used to lookup DNS records. This approach resulted in several flakes and required waiting on DNS servers to have the records available. The CLI is more stable, but has a greater call overhead. This PR also introduces a cache to reduce the cost of the `LookupSRVRecords` call which could be called frequently depending on the origin of use. The cache is updated for any CRUD operations on the DNS entries, and a call to the CLI will not occur if any entry exists for the name the lookup is attempting. The names are also normalised to remove a trailing dot in order to make matching against the cache work correctly. There is a small risk that the cache could go out of sync if any other roachprod process manipulates the records with a create, update or destroy operation, while a continuous roachprod process is interacting with the entries. This risk is relatively small and usually applies to roachtest rather than everyday use of roachprod. Fixes cockroachdb#111269 Epic: None Release Note: None 113996: upgrade: use high priority txn's to update the cluster version r=fqazi a=fqazi Previously, it was possible for the leasing subsystem to starve out attempts to set the cluster version during upgrades, since the leasing subsystem uses high priority txn for renewals. To address this, this patch makes the logic to set the cluster version high priority so it can't be pushed out by lease renewals. Fixes: cockroachdb#113908 Release note (bug fix): Addressed a bug that could cause cluster version finalization to get starved out by descriptor lease renewals on larger clusters. Co-authored-by: Herko Lategan <[email protected]> Co-authored-by: Faizan Qazi <[email protected]>
- Loading branch information
Showing
13 changed files
with
401 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2023 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package settingswatcher | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/keys" | ||
"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" | ||
"github.com/cockroachdb/cockroach/pkg/sql/catalog/systemschema" | ||
"github.com/cockroachdb/cockroach/pkg/sql/rowenc/valueside" | ||
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree" | ||
"github.com/cockroachdb/cockroach/pkg/util/encoding" | ||
"github.com/cockroachdb/cockroach/pkg/util/timeutil" | ||
) | ||
|
||
// EncodeSettingKey encodes a key for the system.settings table, which | ||
// can be used for direct KV operations. | ||
func EncodeSettingKey(codec keys.SQLCodec, setting string) []byte { | ||
indexPrefix := codec.IndexPrefix(keys.SettingsTableID, uint32(1)) | ||
return encoding.EncodeUvarintAscending(encoding.EncodeStringAscending(indexPrefix, setting), uint64(0)) | ||
} | ||
|
||
// EncodeSettingValue encodes a value for the system.settings table, which | ||
// can be used for direct KV operations. | ||
func EncodeSettingValue(rawValue []byte, valueType string) ([]byte, error) { | ||
// Encode the setting value to write out the updated version. | ||
var tuple []byte | ||
var err error | ||
if tuple, err = valueside.Encode(tuple, | ||
valueside.MakeColumnIDDelta(descpb.ColumnID(encoding.NoColumnID), | ||
systemschema.SettingsTable.PublicColumns()[1].GetID()), | ||
tree.NewDString(string(rawValue)), | ||
nil); err != nil { | ||
return nil, err | ||
} | ||
if tuple, err = valueside.Encode(tuple, | ||
valueside.MakeColumnIDDelta(systemschema.SettingsTable.PublicColumns()[1].GetID(), | ||
systemschema.SettingsTable.PublicColumns()[2].GetID()), | ||
tree.MustMakeDTimestamp(timeutil.Now(), time.Microsecond), | ||
nil); err != nil { | ||
return nil, err | ||
} | ||
if tuple, err = valueside.Encode(tuple, | ||
valueside.MakeColumnIDDelta(systemschema.SettingsTable.PublicColumns()[2].GetID(), | ||
systemschema.SettingsTable.PublicColumns()[3].GetID()), | ||
tree.NewDString(valueType), | ||
nil); err != nil { | ||
return nil, err | ||
} | ||
return tuple, nil | ||
} |
Oops, something went wrong.