Skip to content
This repository has been archived by the owner on Mar 30, 2020. It is now read-only.

Commit

Permalink
*: un-singletonize the cluster settings
Browse files Browse the repository at this point in the history
Apologies to drop such a huge refactoring, but it was a bit of a coup de force
required (or at least strongly suggested) by my inflight PR on version
migration (#17411).

We were previously using our singleton-based `settings` package that originally
replaced the use of environment variables. Its use, however, has since
diversified, the cluster version setting being the most elaborate addition.

In #17411 it has turned out that with these singletons in place, a lot of
effort and hacks are required to even be able to run tests at the same version.
However, it would be nice to test nonidentical versions in cluster tests.

Consequently, this PR

- introduces a struct `cluster.Settings` which now holds all the settings
  previously scattered around the code base; and
- plumbs this struct everywhere it's needed.

There are some open FIXMEs but I'd like a reviewer to review the bulk that's
here in the initial commit (which should pass all tests). I will then address
the FIXMEs (which require more focused attention) in follow-up commits, before
merging this PR.
  • Loading branch information
tbg committed Aug 8, 2017
1 parent 0e3c0bc commit 031691d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (

"golang.org/x/net/context"

"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/sql"
"github.com/cockroachdb/cockroach/pkg/sql/mon"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/metric"
"github.com/cockroachdb/cockroach/pkg/util/tracing"
"github.com/pkg/errors"
)

Expand All @@ -38,9 +38,11 @@ func makeTestV3Conn(c net.Conn) v3Conn {
mon := mon.MakeUnlimitedMonitor(
context.Background(), "test", mon.MemoryResource, nil, nil, 1000,
)
st := cluster.MakeClusterSettings()
exec := sql.NewExecutor(
sql.ExecutorConfig{
AmbientCtx: log.AmbientContext{Tracer: tracing.NewTracer()},
AmbientCtx: log.AmbientContext{Tracer: st.Tracer},
Settings: st,
HistogramWindowInterval: metric.TestSampleInterval,
TestingKnobs: &sql.ExecutorTestingKnobs{},
SessionRegistry: sql.MakeSessionRegistry(),
Expand Down

0 comments on commit 031691d

Please sign in to comment.