Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
67228: cloud: add child span in external storage WriteFile r=dt a=adityamaru

This change adds a child span to the `WriteFile` method
so that we can track the duration of an upload.

Release note: None

67533: server: use actual TenantID for multi-tenant KV admission control r=sumeerbhola a=sumeerbhola

Informs #65954

Release note (ops change): Enabling admission.kv.enabled may provide
better inter-tenant isolation for multi-tenant KV nodes.

67543: roachtest: fix tpchvec/smithcmp r=yuzefovich a=yuzefovich

The config file has recently been moved to a different location, and
`tpchvec/smithcmp` test was broken. This is now fixed.

Fixes: #67353.
Fixes: #67361.

Release note: None

Co-authored-by: Aditya Maru <adityamaru@gmail.com>
Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
  • Loading branch information
4 people committed Jul 13, 2021
4 parents fdb86a2 + 7729fd6 + 34c1ba9 + a5e24fb commit 706f0d2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpchvec.go
Expand Up @@ -520,7 +520,7 @@ func smithcmpTestRun(
tc.preTestRunHook(ctx, t, c, conn, runConfig.clusterSetups[0])
const (
configFile = `tpchvec_smithcmp.toml`
configURL = `https://raw.githubusercontent.com/cockroachdb/cockroach/master/pkg/cmd/roachtest/` + configFile
configURL = `https://raw.githubusercontent.com/cockroachdb/cockroach/master/pkg/cmd/roachtest/tests/` + configFile
)
firstNode := c.Node(1)
if err := c.RunE(ctx, firstNode, fmt.Sprintf("curl %s > %s", configURL, configFile)); err != nil {
Expand Down
17 changes: 12 additions & 5 deletions pkg/server/node.go
Expand Up @@ -916,12 +916,19 @@ func (n *Node) Batch(
var callAdmittedWorkDone bool
var tenantID roachpb.TenantID
if n.admissionQ != nil {
var ok bool
tenantID, ok = roachpb.TenantFromContext(ctx)
if !ok {
tenantID = roachpb.SystemTenantID
}
bypassAdmission := args.IsAdmin()
// TODO(sumeer): properly initialize tenant ID. If non-SystemTenantID sends
// a request with source other than AdmissionHeader_FROM_SQL, change it to
// FROM_SQL.
tenantID = roachpb.SystemTenantID
if args.AdmissionHeader.Source == roachpb.AdmissionHeader_OTHER {
source := args.AdmissionHeader.Source
if !roachpb.IsSystemTenantID(tenantID.ToUint64()) {
// Request is from a SQL node.
bypassAdmission = false
source = roachpb.AdmissionHeader_FROM_SQL
}
if source == roachpb.AdmissionHeader_OTHER {
bypassAdmission = true
}
createTime := args.AdmissionHeader.CreateTime
Expand Down
8 changes: 7 additions & 1 deletion pkg/storage/cloud/cloud_io.go
Expand Up @@ -14,6 +14,7 @@ import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"net/http"
"strconv"
Expand Down Expand Up @@ -325,7 +326,12 @@ func (s *backgroundPipe) Close() error {
// WriteFile is a helper for writing the content of a Reader to the given path
// of an ExternalStorage.
func WriteFile(ctx context.Context, dest ExternalStorage, basename string, src io.Reader) error {
ctx, cancel := context.WithCancel(ctx)
var span *tracing.Span
ctx, span = tracing.ChildSpan(ctx, fmt.Sprintf("%s.WriteFile", dest.Conf().Provider.String()))
defer span.Finish()

var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()

w, err := dest.Writer(ctx, basename)
Expand Down

0 comments on commit 706f0d2

Please sign in to comment.