Skip to content

Commit f29b2f9

Browse files
committed
concurrency: disallow lock flushing in production builds
This is an undocumented setting that is still under development. While it is undocumented, this additional check will avoid any accidental use. Epic: none Release note: None
1 parent dddeb0d commit f29b2f9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/kv/kvserver/concurrency/concurrency_manager.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
2525
"github.com/cockroachdb/cockroach/pkg/storage"
2626
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
27+
"github.com/cockroachdb/cockroach/pkg/util/buildutil"
2728
"github.com/cockroachdb/cockroach/pkg/util/debugutil"
2829
"github.com/cockroachdb/cockroach/pkg/util/hlc"
2930
"github.com/cockroachdb/cockroach/pkg/util/log"
@@ -132,15 +133,27 @@ var UnreplicatedLockReliabilityLeaseTransfer = settings.RegisterBoolSetting(
132133
"kv.lock_table.unreplicated_lock_reliability.lease_transfer.enabled",
133134
"whether the replica should attempt to keep unreplicated locks during lease transfers",
134135
metamorphic.ConstantWithTestBool("kv.lock_table.unreplicated_lock_reliability.lease_transfer.enabled", false),
136+
settings.WithValidateBool(func(_ *settings.Values, enabled bool) error {
137+
if enabled && !buildutil.CrdbTestBuild {
138+
return errors.Newf("kv.lock_table.unreplicated_lock_reliability.lease_transfer.enabled is not supported in production builds")
139+
}
140+
return nil
141+
}),
135142
)
136143

137-
// UnreplicatedLockReliabilityMerge controls whether the replica will
138-
// attempt to keep unreplicated locks during range merge operations.
144+
// UnreplicatedLockReliabilityMerge controls whether the replica will attempt to
145+
// keep unreplicated locks during range merge operations.
139146
var UnreplicatedLockReliabilityMerge = settings.RegisterBoolSetting(
140147
settings.SystemOnly,
141148
"kv.lock_table.unreplicated_lock_reliability.merge.enabled",
142149
"whether the replica should attempt to keep unreplicated locks during range merges",
143150
metamorphic.ConstantWithTestBool("kv.lock_table.unreplicated_lock_reliability.merge.enabled", false),
151+
settings.WithValidateBool(func(_ *settings.Values, enabled bool) error {
152+
if enabled && !buildutil.CrdbTestBuild {
153+
return errors.Newf("kv.lock_table.unreplicated_lock_reliability.merge.enabled is not supported in production builds")
154+
}
155+
return nil
156+
}),
144157
)
145158

146159
var MaxLockFlushSize = settings.RegisterByteSizeSetting(

0 commit comments

Comments
 (0)