-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: introduce contention event store
This commit introduces contention event store, an in-memory key-value FIFO store that stores historical contention events and map collected contention events to their corresponding transaction fingerprint IDs. Release note (sql change): A new cluster setting `sql.contention.event_store.capacity` is added . This cluster setting can be used to control the in-memory capacity of contention event store. When this setting is set to zero, the contention event store is disabled.
- Loading branch information
Showing
13 changed files
with
667 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2022 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 contention | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/settings" | ||
) | ||
|
||
// TxnIDResolutionInterval is the cluster setting that controls how often the | ||
// Transaction ID Resolution is performed. | ||
var TxnIDResolutionInterval = settings.RegisterDurationSetting( | ||
settings.TenantWritable, | ||
"sql.contention.event_store.resolution_interval", | ||
"the interval at which transaction ID resolution is performed (set to 0 to disable)", | ||
time.Second*30, | ||
) | ||
|
||
// StoreCapacity is the cluster setting that controls the | ||
// maximum size of the contention event store. | ||
var StoreCapacity = settings.RegisterByteSizeSetting( | ||
settings.TenantWritable, | ||
"sql.contention.event_store.capacity", | ||
"the in-memory storage capacity per-node of contention event store", | ||
64*1024*1024, // 64 MB per node. | ||
).WithPublic() |
Oops, something went wrong.