Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1834,10 +1834,10 @@ def go_deps():
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch",
],
sha256 = "1fcaa5c3baecb9719f8aa46b75020d0a87927e5e2496bcfa82e689d2ffea9c6b",
strip_prefix = "github.com/cockroachdb/[email protected]20251002180823-347d5dc77850",
sha256 = "0c4dcc7c2e3c2b44a566defd420a2c0d49273f6ed6813f49fc4b5be863eb863e",
strip_prefix = "github.com/cockroachdb/[email protected]20251003225047-642b75687547",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251002180823-347d5dc77850.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251003225047-642b75687547.zip",
],
)
go_repository(
Expand Down Expand Up @@ -7553,6 +7553,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/PuerkitoBio/urlesc/com_github_puerkitobio_urlesc-v0.0.0-20170810143723-de5bf2ad4578.zip",
],
)
go_repository(
name = "com_github_puzpuzpuz_xsync_v3",
build_file_proto_mode = "disable_global",
importpath = "github.com/puzpuzpuz/xsync/v3",
sha256 = "f7fcd1eeb1bc96bc497dc0bca05ed0d64d194fdb1a73460dd42cd2bc42ae00e6",
strip_prefix = "github.com/puzpuzpuz/xsync/[email protected]",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/puzpuzpuz/xsync/v3/com_github_puzpuzpuz_xsync_v3-v3.5.1.zip",
],
)
go_repository(
name = "com_github_raduberinde_axisds",
build_file_proto_mode = "disable_global",
Expand Down
3 changes: 2 additions & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.19.0.zip": "c4d516bcfe8c07b6fc09b8a9a07a95065b36c2855627cb3514e40c98f872b69e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20241215232642-bb51bb14a506.zip": "920068af09e3846d9ebb4e4a7787ff1dd10f3989c5f940ad861b0f6a9f824f6e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/metamorphic/com_github_cockroachdb_metamorphic-v0.0.0-20231108215700-4ba948b56895.zip": "28c8cf42192951b69378cf537be5a9a43f2aeb35542908cc4fe5f689505853ea",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251002180823-347d5dc77850.zip": "1fcaa5c3baecb9719f8aa46b75020d0a87927e5e2496bcfa82e689d2ffea9c6b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251003225047-642b75687547.zip": "0c4dcc7c2e3c2b44a566defd420a2c0d49273f6ed6813f49fc4b5be863eb863e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/redact/com_github_cockroachdb_redact-v1.1.6.zip": "018eccb5fb9ca52d43ec9eaf213539d01c1f2b94e0e822406ebfb2e9321ef6cf",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/returncheck/com_github_cockroachdb_returncheck-v0.0.0-20200612231554-92cdbca611dd.zip": "ce92ba4352deec995b1f2eecf16eba7f5d51f5aa245a1c362dfe24c83d31f82b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/stress/com_github_cockroachdb_stress-v0.0.0-20220803192808-1806698b1b7b.zip": "3fda531795c600daf25532a4f98be2a1335cd1e5e182c72789bca79f5f69fcc1",
Expand Down Expand Up @@ -895,6 +895,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/statsd_exporter/com_github_prometheus_statsd_exporter-v0.21.0.zip": "aa848ade6fb019df4f7992808a1d6aa48d6b8276017970af4aabc1bd337c2dc3",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/pseudomuto/protoc-gen-doc/com_github_pseudomuto_protoc_gen_doc-v1.3.2.zip": "ecf627d6f5b4e55d4844dda45612cbd152f0bc4dbe2ba182c7bc3ad1dc63ce5f",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/pseudomuto/protokit/com_github_pseudomuto_protokit-v0.2.0.zip": "16d5fe0f6ac5bebbf9f2f05fde72f28bbf05bb18baef045b9ae79c2585f4e127",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/puzpuzpuz/xsync/v3/com_github_puzpuzpuz_xsync_v3-v3.5.1.zip": "f7fcd1eeb1bc96bc497dc0bca05ed0d64d194fdb1a73460dd42cd2bc42ae00e6",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/rcrowley/go-metrics/com_github_rcrowley_go_metrics-v0.0.0-20201227073835-cf1acfcdf475.zip": "e4dbd20c185cb05019fd7d4a361266bd5d182938f49fd9577df4d12c16dc81c3",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/remyoudompheng/bigfft/com_github_remyoudompheng_bigfft-v0.0.0-20230129092748-24d4a6f8daec.zip": "9be16c32c384d55d0f7bd7b03f1ff1e9a4e4b91b000f0aa87a567a01b9b82398",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/retailnext/hllpp/com_github_retailnext_hllpp-v1.0.1-0.20180308014038-101a6d2f8b52.zip": "7863938cb01dfe9d4495df3c6608bedceec2d1195da05612f3c1b0e27d37729d",
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ require (
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
github.com/cockroachdb/gostdlib v1.19.0
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506
github.com/cockroachdb/pebble v0.0.0-20251002180823-347d5dc77850
github.com/cockroachdb/pebble v0.0.0-20251003225047-642b75687547
github.com/cockroachdb/redact v1.1.6
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd
github.com/cockroachdb/stress v0.0.0-20220803192808-1806698b1b7b
Expand Down Expand Up @@ -432,6 +432,7 @@ require (
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/pseudomuto/protokit v0.2.0 // indirect
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/xid v1.3.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 h1:ASDL+UJcILM
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506/go.mod h1:Mw7HqKr2kdtu6aYGn3tPmAftiP3QPX63LdK/zcariIo=
github.com/cockroachdb/metamorphic v0.0.0-20231108215700-4ba948b56895 h1:XANOgPYtvELQ/h4IrmPAohXqe2pWA8Bwhejr3VQoZsA=
github.com/cockroachdb/metamorphic v0.0.0-20231108215700-4ba948b56895/go.mod h1:aPd7gM9ov9M8v32Yy5NJrDyOcD8z642dqs+F0CeNXfA=
github.com/cockroachdb/pebble v0.0.0-20251002180823-347d5dc77850 h1:pT7rhCsjLQJrmTxV79g6d0oSBSgJ4Mqqs448ADowab0=
github.com/cockroachdb/pebble v0.0.0-20251002180823-347d5dc77850/go.mod h1:H/DxkYtsYVJwPFLikOL9yzb/PV7oIkz44CUmn4KecKg=
github.com/cockroachdb/pebble v0.0.0-20251003225047-642b75687547 h1:dN+murp3HTnlNozWbdwSNpoEmIelRZC/h1f6O02w4bA=
github.com/cockroachdb/pebble v0.0.0-20251003225047-642b75687547/go.mod h1:GflN9NRwberlF+gFRJd6r6jrUYdWR/QD+gtgtH0LRK8=
github.com/cockroachdb/redact v1.1.6 h1:zXJBwDZ84xJNlHl1rMyCojqyIxv+7YUpQiJLQ7n4314=
github.com/cockroachdb/redact v1.1.6/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd h1:KFOt5I9nEKZgCnOSmy8r4Oykh8BYQO8bFOTgHDS8YZA=
Expand Down Expand Up @@ -2053,6 +2053,8 @@ github.com/pseudomuto/protoc-gen-doc v1.3.2 h1:61vWZuxYa8D7Rn4h+2dgoTNqnluBmJya2
github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA=
github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM=
github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q=
github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++5Fg=
github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
Expand Down
1 change: 1 addition & 0 deletions pkg/kv/kvserver/abortspan/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ go_library(
"//pkg/roachpb",
"//pkg/storage",
"//pkg/storage/enginepb",
"//pkg/storage/fs",
"//pkg/util/hlc",
"//pkg/util/log",
"//pkg/util/uuid",
Expand Down
5 changes: 4 additions & 1 deletion pkg/kv/kvserver/abortspan/abortspan.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage"
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/storage/fs"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/uuid"
Expand Down Expand Up @@ -87,7 +88,9 @@ func (sc *AbortSpan) Get(
) (bool, error) {
// Pull response from disk and read into reply if available.
key := keys.AbortSpanKey(sc.rangeID, txnID)
ok, err := storage.MVCCGetProto(ctx, reader, key, hlc.Timestamp{}, entry, storage.MVCCGetOptions{})
ok, err := storage.MVCCGetProto(ctx, reader, key, hlc.Timestamp{}, entry, storage.MVCCGetOptions{
ReadCategory: fs.AbortSpanReadCategory,
})
return ok, err
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/storage/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,8 @@ func GetIntent(ctx context.Context, reader Reader, key roachpb.Key) (*roachpb.In
opts := LockTableIteratorOptions{
Prefix: true,
// Ignore Exclusive and Shared locks. We only care about intents.
MatchMinStr: lock.Intent,
MatchMinStr: lock.Intent,
ReadCategory: fs.IntentResolutionReadCategory,
}
iter, err := NewLockTableIterator(ctx, reader, opts)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/storage/fs/category.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const (
IntentResolutionReadCategory
// BackupReadCategory are reads for backups.
BackupReadCategory
// AbortSpanReadCategory are reads used to check if a txn was aborted.
AbortSpanReadCategory
)

var readCategoryMap = [...]block.Category{
Expand All @@ -59,6 +61,7 @@ var readCategoryMap = [...]block.Category{
ReplicationReadCategory: block.RegisterCategory("replication", block.LatencySensitiveQoSLevel),
IntentResolutionReadCategory: block.RegisterCategory("intent-resolution", block.LatencySensitiveQoSLevel),
BackupReadCategory: block.RegisterCategory("backup", block.NonLatencySensitiveQoSLevel),
AbortSpanReadCategory: block.RegisterCategory("abort-span", block.LatencySensitiveQoSLevel),
}

// PebbleCategory returns the block.Category associated with the given ReadCategory.
Expand Down
7 changes: 4 additions & 3 deletions pkg/storage/lock_table_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ func (opts LockTableIteratorOptions) validate() error {
// toIterOptions converts the LockTableIteratorOptions to IterOptions.
func (opts LockTableIteratorOptions) toIterOptions() IterOptions {
return IterOptions{
Prefix: opts.Prefix,
LowerBound: opts.LowerBound,
UpperBound: opts.UpperBound,
Prefix: opts.Prefix,
LowerBound: opts.LowerBound,
UpperBound: opts.UpperBound,
ReadCategory: opts.ReadCategory,
}
}

Expand Down
11 changes: 6 additions & 5 deletions pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ func DefaultPebbleOptions() *pebble.Options {
opts.Experimental.SpanPolicyFunc = spanPolicyFunc
opts.Experimental.UserKeyCategories = userKeyCategories

// Every 5 minutes, log iterators that have been open for more than 1 minute.
opts.Experimental.IteratorTracking.PollInterval = 5 * time.Minute
opts.Experimental.IteratorTracking.MaxAge = time.Minute

opts.Levels[0] = pebble.LevelOptions{
BlockSize: 32 << 10, // 32 KB
IndexBlockSize: 256 << 10, // 256 KB
Expand Down Expand Up @@ -2782,11 +2786,8 @@ func (p *pebbleReadOnly) ConsistentIterators() bool {
// PinEngineStateForIterators implements the Engine interface.
func (p *pebbleReadOnly) PinEngineStateForIterators(readCategory fs.ReadCategory) error {
if p.iter == nil {
o := &pebble.IterOptions{Category: readCategory.PebbleCategory()}
if p.durability == GuaranteedDurability {
o.OnlyReadGuaranteedDurable = true
}
iter, err := p.parent.db.NewIter(o)
o := makeIterOptions(readCategory, p.durability)
iter, err := p.parent.db.NewIter(&o)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/storage/pebble_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,11 @@ func (p *pebbleBatch) PinEngineStateForIterators(readCategory fs.ReadCategory) e
var err error
if p.iter == nil {
var iter *pebble.Iterator
o := &pebble.IterOptions{Category: readCategory.PebbleCategory()}
o := makeIterOptions(readCategory, StandardDurability)
if p.batch.Indexed() {
iter, err = p.batch.NewIter(o)
iter, err = p.batch.NewIter(&o)
} else {
iter, err = p.db.NewIter(o)
iter, err = p.db.NewIter(&o)
}
if err != nil {
return err
Expand Down
28 changes: 21 additions & 7 deletions pkg/storage/pebble_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage/fs"
"github.com/cockroachdb/cockroach/pkg/storage/mvccencoding"
"github.com/cockroachdb/cockroach/pkg/storage/pebbleiter"
"github.com/cockroachdb/cockroach/pkg/util"
Expand Down Expand Up @@ -186,7 +187,6 @@ func (p *pebbleIterator) initReuseOrCreate(

p.init(ctx, nil, opts, durability, statsReporter)
if iter == nil {
// TODO(sumeer): fix after bumping to latest Pebble.
innerIter, err := handle.NewIterWithContext(ctx, &p.options)
if err != nil {
return err
Expand Down Expand Up @@ -222,12 +222,9 @@ func (p *pebbleIterator) setOptions(
}

// Generate new Pebble iterator options.
p.options = pebble.IterOptions{
OnlyReadGuaranteedDurable: durability == GuaranteedDurability,
KeyTypes: opts.KeyTypes,
UseL6Filters: opts.useL6Filters,
Category: opts.ReadCategory.PebbleCategory(),
}
p.options = makeIterOptions(opts.ReadCategory, durability)
p.options.KeyTypes = opts.KeyTypes
p.options.UseL6Filters = opts.useL6Filters
p.prefix = opts.Prefix

if opts.LowerBound != nil {
Expand Down Expand Up @@ -1043,3 +1040,20 @@ func (p *pebbleIterator) assertMVCCInvariants() error {

return nil
}

var exemptFromTracking = [...]bool{
fs.BatchEvalReadCategory: true,
fs.ScanRegularBatchEvalReadCategory: true,
fs.IntentResolutionReadCategory: true,
fs.AbortSpanReadCategory: true,
}

func makeIterOptions(
readCategory fs.ReadCategory, durability DurabilityRequirement,
) pebble.IterOptions {
return pebble.IterOptions{
OnlyReadGuaranteedDurable: durability == GuaranteedDurability,
Category: readCategory.PebbleCategory(),
ExemptFromTracking: int(readCategory) < len(exemptFromTracking) && exemptFromTracking[readCategory],
}
}
Loading