Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
89787: backupccl: replace MultiIterator in BackupMetadata's FileIter r=rhu713 a=msbutler

Informs #87943

Release note: None

89833: descs: use fast path to resolve function r=ajwerner a=ajwerner

This avoids an allocation

Epic: None

Release note: None

89839: vendor: bump Pebble to b6b30d5f81ef r=coolcom200 a=nicktrav

```
b6b30d5f metamorphic/crossversion: use LinkOrCopy
5fdb3ead metric: expose pebble fsync latency with a callback
a4b203ef metrics: remove deprecated InternalIntervalMetrics method
f122ff49 tool: capture stdout / stderr
```

Release note: None.

Epic: None.

Co-authored-by: Michael Butler <[email protected]>
Co-authored-by: Andrew Werner <[email protected]>
Co-authored-by: Nick Travers <[email protected]>
  • Loading branch information
4 people committed Oct 12, 2022
4 parents e1f1842 + 03bfef2 + d12472a + 10f2d25 commit 5515ce7
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 38 deletions.
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1425,10 +1425,10 @@ def go_deps():
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch",
],
sha256 = "11f8da00b0b17fc086174d57fc1cd5e098ab0d62b752fd0c6db755873c3fe133",
strip_prefix = "github.com/cockroachdb/[email protected]20221005185728-eec7375f9c44",
sha256 = "677cacd283708026a5e5a3f0fa247e249f9d9aaf4ff1916a29c0c7fdd383558c",
strip_prefix = "github.com/cockroachdb/[email protected]20221012145223-b6b30d5f81ef",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20221005185728-eec7375f9c44.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20221012145223-b6b30d5f81ef.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/go-test-teamcity/com_github_cockroachdb_go_test_teamcity-v0.0.0-20191211140407-cff980ad0a55.zip": "bac30148e525b79d004da84d16453ddd2d5cd20528e9187f1d7dac708335674b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.13.0.zip": "b3d43d8f95edf65f73a5348f29e1159823cac64b148f8d3bb48340bf55d70872",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20211118104740-dabe8e521a4f.zip": "1972c3f171f118add3fd9e64bcea6cbb9959a3b7fa0ada308e8a7310813fea74",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20221005185728-eec7375f9c44.zip": "11f8da00b0b17fc086174d57fc1cd5e098ab0d62b752fd0c6db755873c3fe133",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20221012145223-b6b30d5f81ef.zip": "677cacd283708026a5e5a3f0fa247e249f9d9aaf4ff1916a29c0c7fdd383558c",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/redact/com_github_cockroachdb_redact-v1.1.3.zip": "7778b1e4485e4f17f35e5e592d87eb99c29e173ac9507801d000ad76dd0c261e",
"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/sentry-go/com_github_cockroachdb_sentry_go-v0.6.1-cockroachdb.2.zip": "fbb2207d02aecfdd411b1357efe1192dbb827959e36b7cab7491731ac55935c9",
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
github.com/cockroachdb/gostdlib v1.13.0
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f
github.com/cockroachdb/pebble v0.0.0-20221005185728-eec7375f9c44
github.com/cockroachdb/pebble v0.0.0-20221012145223-b6b30d5f81ef
github.com/cockroachdb/redact v1.1.3
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd
github.com/cockroachdb/stress v0.0.0-20220803192808-1806698b1b7b
Expand Down Expand Up @@ -194,7 +194,6 @@ require (
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM=
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74=
Expand Down Expand Up @@ -462,8 +461,8 @@ github.com/cockroachdb/gostdlib v1.13.0/go.mod h1:eXX95p9QDrYwJfJ6AgeN9QnRa/lqqi
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f h1:6jduT9Hfc0njg5jJ1DdKCFPdMBrp/mdZfCpa5h+WM74=
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/pebble v0.0.0-20221005185728-eec7375f9c44 h1:Ha5v3bDGAkhldJU979no/68P19GUbprl8Y/E9dF+eUU=
github.com/cockroachdb/pebble v0.0.0-20221005185728-eec7375f9c44/go.mod h1:VwtfSXtDy6k5IlH5slcSwquGNA6uPezrtjAHVNlc/kM=
github.com/cockroachdb/pebble v0.0.0-20221012145223-b6b30d5f81ef h1:4XTg8lzx+p3J422OOqXzhyhJEx/oVTickAh7aDZvK+o=
github.com/cockroachdb/pebble v0.0.0-20221012145223-b6b30d5f81ef/go.mod h1:VwtfSXtDy6k5IlH5slcSwquGNA6uPezrtjAHVNlc/kM=
github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd h1:KFOt5I9nEKZgCnOSmy8r4Oykh8BYQO8bFOTgHDS8YZA=
Expand Down Expand Up @@ -2827,7 +2826,6 @@ gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJ
gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=
gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM=
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
Expand Down
5 changes: 4 additions & 1 deletion pkg/ccl/backupccl/backup_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ func checkFiles(
) {
var metaFiles []backuppb.BackupManifest_File
var file backuppb.BackupManifest_File
it := bm.FileIter(ctx)
it, err := bm.NewFileIter(ctx)
if err != nil {
t.Fatal(err)
}
defer it.Close()

for it.Next(&file) {
Expand Down
41 changes: 17 additions & 24 deletions pkg/ccl/backupccl/backupinfo/backup_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const (
)

var iterOpts = storage.IterOptions{
KeyTypes: storage.IterKeyTypePointsAndRanges,
KeyTypes: storage.IterKeyTypePointsOnly,
LowerBound: keys.LocalMax,
UpperBound: keys.MaxKey,
}
Expand Down Expand Up @@ -961,23 +961,22 @@ func (si *SpanIterator) Next(span *roachpb.Span) bool {

// FileIterator is a simple iterator to iterate over stats.TableStatisticProtos.
type FileIterator struct {
mergedIterator storage.SimpleMVCCIterator
backingIterators []storage.SimpleMVCCIterator
err error
mergedIterator storage.SimpleMVCCIterator
err error
}

// FileIter creates a new FileIterator for the backup metadata.
func (b *BackupMetadata) FileIter(ctx context.Context) FileIterator {
// NewFileIter creates a new FileIterator for the backup metadata.
func (b *BackupMetadata) NewFileIter(ctx context.Context) (*FileIterator, error) {
fileInfoIter := makeBytesIter(ctx, b.store, b.filename, []byte(sstFilesPrefix), b.enc,
false, b.kmsEnv)
defer fileInfoIter.close()

var iters []storage.SimpleMVCCIterator
var storeFiles []storageccl.StoreFile
var encOpts *roachpb.FileEncryptionOptions
if b.enc != nil {
key, err := backupencryption.GetEncryptionKey(ctx, b.enc, b.kmsEnv)
if err != nil {
return FileIterator{err: err}
return nil, err
}
encOpts = &roachpb.FileEncryptionOptions{Key: key}
}
Expand All @@ -988,30 +987,24 @@ func (b *BackupMetadata) FileIter(ctx context.Context) FileIterator {
if err != nil {
break
}
iter, err := storageccl.ExternalSSTReader(ctx, []storageccl.StoreFile{{Store: b.store,
FilePath: path}}, encOpts, iterOpts)
if err != nil {
return FileIterator{err: err}
}
iters = append(iters, iter)
storeFiles = append(storeFiles, storageccl.StoreFile{Store: b.store,
FilePath: path})
}

if fileInfoIter.err() != nil {
return FileIterator{err: fileInfoIter.err()}
return nil, fileInfoIter.err()
}

mergedIter := storage.MakeMultiIterator(iters)
mergedIter.SeekGE(storage.MVCCKey{})
return FileIterator{mergedIterator: mergedIter, backingIterators: iters}
iter, err := storageccl.ExternalSSTReader(ctx, storeFiles, encOpts, iterOpts)
if err != nil {
return nil, err
}
iter.SeekGE(storage.MVCCKey{})
return &FileIterator{mergedIterator: iter}, nil
}

// Close closes the iterator.
func (fi *FileIterator) Close() {
for _, it := range fi.backingIterators {
it.Close()
}
fi.mergedIterator = nil
fi.backingIterators = fi.backingIterators[:0]
fi.mergedIterator.Close()
}

// Err returns the iterator's error.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/catalog/descs/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ func (tc *Collection) GetMutableFunctionByID(
func (tc *Collection) getFunctionByID(
ctx context.Context, txn *kv.Txn, fnID descpb.ID, flags tree.ObjectLookupFlags,
) (catalog.FunctionDescriptor, error) {
descs, err := tc.getDescriptorsByID(ctx, txn, flags.CommonLookupFlags, fnID)
desc, err := tc.getDescriptorByID(ctx, txn, flags.CommonLookupFlags, fnID)
if err != nil {
if errors.Is(err, catalog.ErrDescriptorNotFound) {
return nil, errors.Wrapf(tree.ErrFunctionUndefined, "function %d does not exist", fnID)
}
return nil, err
}
fn, ok := descs[0].(catalog.FunctionDescriptor)
fn, ok := desc.(catalog.FunctionDescriptor)
if !ok {
return nil, errors.Wrapf(tree.ErrFunctionUndefined, "function %d does not exist", fnID)
}
Expand Down

0 comments on commit 5515ce7

Please sign in to comment.