Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Change default for unix socket #28486

Merged
merged 5 commits into from
Oct 20, 2021
Merged
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
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ var defaultConf = Config{
Host: DefHost,
AdvertiseAddress: "",
Port: DefPort,
Socket: "/tmp/tidb.sock",
Cors: "",
Store: "unistore",
Path: "/tmp/tidb",
Expand Down
2 changes: 1 addition & 1 deletion config/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ store = "unistore"
path = "/tmp/tidb"

# The socket file to use for connection.
socket = ""
socket = "/tmp/tidb.sock"

# Run ddl worker on this tidb-server.
run-ddl = true
Expand Down
2 changes: 2 additions & 0 deletions server/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func TestInitialHandshake(t *testing.T) {

var outBuffer bytes.Buffer
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = 0
cfg.Status.StatusPort = 0
drv := NewTiDBDriver(store)
Expand Down Expand Up @@ -486,6 +487,7 @@ func testDispatch(t *testing.T, inputs []dispatchInput, capability uint32) {
var outBuffer bytes.Buffer
tidbdrv := NewTiDBDriver(store)
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port, cfg.Status.StatusPort = 0, 0
cfg.Status.ReportStatus = false
server, err := NewServer(cfg, tidbdrv)
Expand Down
11 changes: 11 additions & 0 deletions server/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func (ts *tidbTestSuiteBase) SetUpSuite(c *C) {
c.Assert(err, IsNil)
ts.tidbdrv = NewTiDBDriver(ts.store)
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = ts.port
cfg.Status.ReportStatus = true
cfg.Status.StatusPort = ts.statusPort
Expand Down Expand Up @@ -274,6 +275,7 @@ func (ts *tidbTestSuite) TestStatusPort(c *C) {
defer dom.Close()
ts.tidbdrv = NewTiDBDriver(store)
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = 0
cfg.Status.ReportStatus = true
cfg.Status.StatusPort = ts.statusPort
Expand All @@ -300,6 +302,7 @@ func (ts *tidbTestSuite) TestStatusAPIWithTLS(c *C) {
cli := newTestServerClient()
cli.statusScheme = "https"
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.StatusPort = cli.statusPort
cfg.Security.ClusterSSLCA = "/tmp/ca-cert-2.pem"
Expand Down Expand Up @@ -351,6 +354,7 @@ func (ts *tidbTestSuite) TestStatusAPIWithTLSCNCheck(c *C) {
cli := newTestServerClient()
cli.statusScheme = "https"
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.StatusPort = cli.statusPort
cfg.Security.ClusterSSLCA = caPath
Expand Down Expand Up @@ -866,6 +870,7 @@ func registerTLSConfig(configName string, caCertPath string, clientCertPath stri
func (ts *tidbTestSuite) TestSystemTimeZone(c *C) {
tk := testkit.NewTestKit(c, ts.store)
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port, cfg.Status.StatusPort = 0, 0
cfg.Status.ReportStatus = false
server, err := NewServer(cfg, ts.tidbdrv)
Expand All @@ -883,6 +888,7 @@ func (ts *tidbTestSerialSuite) TestTLSAuto(c *C) {
}
cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.ReportStatus = false
cfg.Security.AutoTLS = true
Expand Down Expand Up @@ -935,6 +941,7 @@ func (ts *tidbTestSerialSuite) TestTLSBasic(c *C) {
}
cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.ReportStatus = false
cfg.Security = config.Security{
Expand Down Expand Up @@ -1001,6 +1008,7 @@ func (ts *tidbTestSerialSuite) TestTLSVerify(c *C) {
// Start the server with TLS & CA, if the client presents its certificate, the certificate will be verified.
cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.ReportStatus = false
cfg.Security = config.Security{
Expand Down Expand Up @@ -1066,6 +1074,7 @@ func (ts *tidbTestSerialSuite) TestReloadTLS(c *C) {
// try old cert used in startup configuration.
cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.ReportStatus = false
cfg.Security = config.Security{
Expand Down Expand Up @@ -1166,6 +1175,7 @@ func (ts *tidbTestSerialSuite) TestErrorNoRollback(c *C) {

cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.ReportStatus = false

Expand Down Expand Up @@ -1500,6 +1510,7 @@ func (ts *tidbTestSuite) TestGracefulShutdown(c *C) {
ts.tidbdrv = NewTiDBDriver(ts.store)
cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.GracefulWaitBeforeShutdown = 2 // wait before shutdown
cfg.Port = 0
cfg.Status.StatusPort = 0
Expand Down