Skip to content
Open
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
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11080,10 +11080,10 @@ def go_deps():
name = "io_storj_drpc",
build_file_proto_mode = "disable_global",
importpath = "storj.io/drpc",
sha256 = "089481375939240f2fd5c2caa87ecde398bb2a9fb7d7998a2cee8ad0624a7ea1",
strip_prefix = "github.com/cockroachdb/drpc@v0.0.0-20260406142218-6c77a9e470d3",
sha256 = "7c658dfbb3603b4351e4d0d91b91a9787d868348915582f547446e9f96b6ac11",
strip_prefix = "github.com/shubhamdhama/drpc@v0.0.0-20260511155932-95375d1e96eb",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/drpc/com_github_cockroachdb_drpc-v0.0.0-20260406142218-6c77a9e470d3.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shubhamdhama/drpc/com_github_shubhamdhama_drpc-v0.0.0-20260511155932-95375d1e96eb.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 @@ -349,7 +349,6 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/crlfmt/com_github_cockroachdb_crlfmt-v0.0.0-20221214225007-b2fc5c302548.zip": "fedc01bdd6d964da0425d5eaac8efadc951e78e13f102292cc0774197f09ab63",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/crlib/com_github_cockroachdb_crlib-v0.0.0-20251122031428-fe658a2dbda1.zip": "fa361e52b072ce18ac1d103e2556851906477361b5fe688745d29b1efabff3cb",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/datadriven/com_github_cockroachdb_datadriven-v1.0.3-0.20251123150250-ddff6747b112.zip": "6c1ae8a9550d3a92f85d7371e5c0caf922dc0ff1425e299359814b6a9a587f14",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/drpc/com_github_cockroachdb_drpc-v0.0.0-20260406142218-6c77a9e470d3.zip": "089481375939240f2fd5c2caa87ecde398bb2a9fb7d7998a2cee8ad0624a7ea1",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/errors/com_github_cockroachdb_errors-v1.12.1-0.20251010171200-64801262cd6f.zip": "4df66cc44791d4290071696abf179dc6df7b94b4cb5d29a20f39c6bf522c60ee",
"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/gogoproto/com_github_cockroachdb_gogoproto-v1.3.3-0.20241216150617-2358cdb156a1.zip": "bf052c9a7f9e23fb3ec7e9f3b7201cfc264c18ed6da0d662952d276dbc339003",
Expand Down Expand Up @@ -936,6 +935,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/sergi/go-diff/com_github_sergi_go_diff-v1.0.0.zip": "287218ffcd136dbb28ce99a2f162048d8dfa6f97b524c17797964aacde2f8f52",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shirou/gopsutil/v3/com_github_shirou_gopsutil_v3-v3.21.12.zip": "ea6f8b430cee40870d8d454aaa5d4c22e84d217a2548a3f755b91a96b1c67a88",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shopspring/decimal/com_github_shopspring_decimal-v1.2.0.zip": "65c34c248e7f736cadf03a7caa0c0870d15499eb593f933fe106c96c2b7699a7",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shubhamdhama/drpc/com_github_shubhamdhama_drpc-v0.0.0-20260511155932-95375d1e96eb.zip": "7c658dfbb3603b4351e4d0d91b91a9787d868348915582f547446e9f96b6ac11",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shurcooL/httpfs/com_github_shurcool_httpfs-v0.0.0-20190707220628-8d4bc4ba7749.zip": "a2079dbd8c236262ecbb22312467265fbbddd9b5ee789531c5f7f24fbdda174b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shurcooL/sanitized_anchor_name/com_github_shurcool_sanitized_anchor_name-v1.0.0.zip": "0af034323e0627a9e94367f87aa50ce29e5b165d54c8da2926cbaffd5834f757",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/shurcooL/vfsgen/com_github_shurcool_vfsgen-v0.0.0-20200824052919-0d455de96546.zip": "98198ecd8f122d1266ff2db193f1aae8a88f2f299bfc34b06ef356694cca537d",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ replace github.com/docker/docker => github.com/moby/moby v25.0.14+incompatible

replace github.com/gogo/protobuf => github.com/cockroachdb/gogoproto v1.3.3-0.20241216150617-2358cdb156a1

replace storj.io/drpc => github.com/cockroachdb/drpc v0.0.0-20260406142218-6c77a9e470d3
replace storj.io/drpc => github.com/shubhamdhama/drpc v0.0.0-20260511155932-95375d1e96eb

// Note: This forked dependency adds a commit that opens up some
// private APIs to enable us to make some perf improvements to
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,6 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z
github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
github.com/cockroachdb/datadriven v1.0.3-0.20251123150250-ddff6747b112 h1:T1++5Vt0/4/IWZ1mHmUYl7fhQnz50QhNWIY+ITvLLIM=
github.com/cockroachdb/datadriven v1.0.3-0.20251123150250-ddff6747b112/go.mod h1:jsaKMvD3RBCATk1/jbUZM8C9idWBJME9+VRZ5+Liq1g=
github.com/cockroachdb/drpc v0.0.0-20260406142218-6c77a9e470d3 h1:Tn7JOQhDXUACzk732VOFSlh9jOlTYEcpZS23MHwyorI=
github.com/cockroachdb/drpc v0.0.0-20260406142218-6c77a9e470d3/go.mod h1:jeOpcnHh3/TvQ7K2kYXyLUMOMoMpuxp5vtdmtNPVW+8=
github.com/cockroachdb/errors v1.12.1-0.20251010171200-64801262cd6f h1:lUmJxzb2/ukuRIvKTaNkvuj5LwlX4u/KxnI3zmx1SSw=
github.com/cockroachdb/errors v1.12.1-0.20251010171200-64801262cd6f/go.mod h1:SvzfYNNBshAVbZ8wzNc/UPK3w1vf0dKDUP41ucAIf7g=
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55 h1:YqzBA7tf8Gv8Oz0BbBsPenqkyjiohS7EUIwi7p1QJCU=
Expand Down Expand Up @@ -2150,6 +2148,8 @@ github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shubhamdhama/drpc v0.0.0-20260511155932-95375d1e96eb h1:40AIbuzpZfhXsWfARr5M3YqcRLCHLs/rhH16EDq0ZCg=
github.com/shubhamdhama/drpc v0.0.0-20260511155932-95375d1e96eb/go.mod h1:jeOpcnHh3/TvQ7K2kYXyLUMOMoMpuxp5vtdmtNPVW+8=
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
Expand Down
26 changes: 24 additions & 2 deletions pkg/rpc/drpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/rpc/rpcbase"
"github.com/cockroachdb/cockroach/pkg/util/envutil"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/cockroach/pkg/util/tracing/drpcinterceptor"
Expand All @@ -30,6 +31,8 @@ import (
"storj.io/drpc/drpcwire"
)

var envExperimentalDRPCMuxEnabled = envutil.EnvOrDefaultBool("COCKROACH_EXPERIMENTAL_DRPC_MUX_ENABLED", false)

// Default idle connection timeout for DRPC connections in the pool.
var defaultDRPCConnIdleTimeout = 5 * time.Minute

Expand Down Expand Up @@ -60,9 +63,16 @@ func DialDRPC(
return ShouldRecordRequestMetricsDRPC(rpcCtx.Settings)
}

drpcDialOptions = append(drpcDialOptions, drpcclient.WithMetrics(cm))
drpcDialOptions = append(drpcDialOptions,
drpcclient.WithShouldRecordFunc(shouldRecordFunc))
drpcclient.WithMetrics(cm),
drpcclient.WithShouldRecordFunc(shouldRecordFunc),
)

if envExperimentalDRPCMuxEnabled {
log.Dev.Infof(ctx, "dialing DRPC mux connection to %s", target)
return dialDRPCMux(ctx, target, drpcDialOptions)
}
log.Dev.Infof(ctx, "dialing DRPC non-mux connection to %s", target)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this and the one above this make the logs a lot noisier since we'll be logging every dial. Maybe lets have some verbosity flag if thats possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes. I'll remove these. They were better for debugging.


drpcPoolMetrics := rpcCtx.DRPCPoolMetrics()
// TODO(server): could use connection class instead of empty key here.
Expand Down Expand Up @@ -93,6 +103,18 @@ func DialDRPC(
}
}

// dialDRPCMux establishes a single DRPC transport connection that carries
// all streams for the peer multiplexed over it.
func dialDRPCMux(
ctx context.Context, target string, drpcDialOptions []drpcclient.DialOption,
) (drpc.Conn, error) {
conn, err := drpcclient.DialContext(ctx, target, drpcDialOptions...)
if err != nil {
return nil, err
}
return drpcclient.NewClientConnWithOptions(ctx, conn, drpcDialOptions...)
}

// drpcDialOptionsInternal is similar to grpcDialOptionsInternal but for
// drpc connections.
func (rpcCtx *Context) drpcDialOptionsInternal(
Expand Down
1 change: 0 additions & 1 deletion pkg/server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ go_test(
"@io_storj_drpc//:drpc",
"@io_storj_drpc//drpcclient",
"@io_storj_drpc//drpcconn",
"@io_storj_drpc//drpcmanager",
"@io_storj_drpc//drpcmigrate",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
Expand Down
7 changes: 1 addition & 6 deletions pkg/server/drpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"storj.io/drpc"
"storj.io/drpc/drpcclient"
"storj.io/drpc/drpcconn"
"storj.io/drpc/drpcmanager"
"storj.io/drpc/drpcmigrate"
)

Expand Down Expand Up @@ -115,11 +114,7 @@ func TestStreamContextCancel(t *testing.T) {
tlsCfg = tlsCfg.Clone()
tlsCfg.ServerName = "*.local"
tlsConn := tls.Client(rawconn, tlsCfg)
conn := drpcconn.NewWithOptions(tlsConn, drpcconn.Options{
Manager: drpcmanager.Options{
SoftCancel: true, // don't close the transport when stream context is canceled
},
})
conn := drpcconn.NewWithOptions(tlsConn, drpcconn.Options{})
defer func() {
require.NoError(t, conn.Close())
}()
Expand Down
7 changes: 4 additions & 3 deletions pkg/sql/tests/sysbench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ func newTestCluster(
}
tc := serverutils.StartCluster(b, nodes, base.TestClusterArgs{
ServerArgs: base.TestServerArgs{
Settings: st,
CacheSize: cacheSize,
Knobs: knobs,
Settings: st,
DefaultDRPCOption: base.TestDRPCEnabled,
CacheSize: cacheSize,
Knobs: knobs,
}},
)
if nodes > 1 {
Expand Down
3 changes: 1 addition & 2 deletions pkg/testutils/serverutils/test_server_shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ func ShouldEnableDRPC(
// Benchmarks need deterministic behavior; skip random DRPC selection.
return base.TestDRPCDisabled
}
rng, _ := randutil.NewTestRand()
enableDRPC = rng.Intn(2) == 0
enableDRPC = true
case base.TestDRPCUnset:
return base.TestDRPCDisabled
}
Expand Down
80 changes: 80 additions & 0 deletions scripts/bump-drpc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env bash

# Copyright 2026 The Cockroach Authors.
#
# Use of this software is governed by the CockroachDB Software License
# included in the /LICENSE file.

# This script bumps the DRPC dependency in go.mod to a given commit.
#
# Usage:
#
# ./scripts/bump-drpc.sh <commit-url>
#
# Where <commit-url> is a GitHub commit link, e.g.:
# https://github.com/cockroachdb/drpc/commit/d57f8922c21431976751f40127e59cda71768431
# https://github.com/shubhamdhama/drpc/commit/d57f8922c21431976751f40127e59cda71768431

set -euo pipefail

if [ -z "${1-}" ]; then
echo "Usage: $0 <github-commit-url>" >&2
echo " e.g. $0 https://github.com/cockroachdb/drpc/commit/abc123" >&2
exit 1
fi

COMMIT_URL="$1"

# Parse the org and SHA from the commit URL.
# Expected format: https://github.com/<org>/drpc/commit/<sha>
if [[ "$COMMIT_URL" =~ github\.com/([^/]+)/drpc/commit/([0-9a-f]+) ]]; then
ORG="${BASH_REMATCH[1]}"
SHA="${BASH_REMATCH[2]}"
else
echo "Error: could not parse commit URL: $COMMIT_URL" >&2
echo "Expected format: https://github.com/<org>/drpc/commit/<sha>" >&2
exit 1
fi

MODULE="github.com/${ORG}/drpc"
echo "Organization: $ORG"
echo "Commit SHA: $SHA"
echo "Module: $MODULE"
echo

# Resolve the pseudo-version for this commit.
echo "Resolving pseudo-version..."
VERSION=$(go list -m -json "${MODULE}@${SHA}" | jq -r '.Version')
if [ -z "$VERSION" ] || [ "$VERSION" == "null" ]; then
echo "Error: could not resolve version for ${MODULE}@${SHA}" >&2
exit 1
fi
echo "Resolved version: $VERSION"
echo

# Update the replace directive in go.mod.
OLD_REPLACE=$(grep '^replace storj.io/drpc =>' go.mod)
NEW_REPLACE="replace storj.io/drpc => ${MODULE} ${VERSION}"

if [ -z "$OLD_REPLACE" ]; then
echo "Error: could not find 'replace storj.io/drpc =>' in go.mod" >&2
exit 1
fi

echo "Old: $OLD_REPLACE"
echo "New: $NEW_REPLACE"
echo

sed -i "s|^replace storj.io/drpc =>.*|${NEW_REPLACE}|" go.mod

# Tidy up.
go mod tidy

# Regenerate Bazel files.
echo "Running dev generate bazel --mirror..."
./dev generate bazel --mirror

echo
echo "Done. DRPC bumped to ${SHA:0:12} (${VERSION})."
echo "Modified files:"
git diff --name-only
Loading