Skip to content

Commit

Permalink
fix: concurrency issue in stdConnOpener (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaflik authored Feb 23, 2023
1 parent 06baf6f commit 2cdfea5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions clickhouse_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ func (o *stdConnOpener) Connect(ctx context.Context) (_ driver.Conn, err error)
return nil, ErrAcquireConnNoAddress
}

o.setClientInfoDefaults()

for i := range o.opt.Addr {
var num int
switch o.opt.ConnOpenStrategy {
Expand All @@ -104,10 +102,6 @@ func (o *stdConnOpener) Connect(ctx context.Context) (_ driver.Conn, err error)
return nil, err
}

func (o *stdConnOpener) setClientInfoDefaults() {
o.opt.ClientInfo.comment = []string{"database/sql"}
}

func init() {
var debugf = func(format string, v ...interface{}) {}
sql.Register("clickhouse", &stdDriver{debugf: debugf})
Expand Down Expand Up @@ -197,6 +191,7 @@ func (std *stdDriver) Open(dsn string) (_ driver.Conn, err error) {
if o.Debug {
debugf = log.New(os.Stdout, fmt.Sprintf("[clickhouse-std][opener] "), 0).Printf
}
o.ClientInfo.comment = []string{"database/sql"}
return (&stdConnOpener{opt: o, debugf: debugf}).Connect(context.Background())
}

Expand Down

0 comments on commit 2cdfea5

Please sign in to comment.