Open
Description
Observed
The error:
clickhouse [execute]:: 403 code: failed to read the response: read: read next block: data size should be 0 < 980316009 < 134217728
Expected behaviour
when i get a query by http connect, the client get this error.
Code example
import (
"database/sql"
"fmt"
"github.com/ClickHouse/clickhouse-go/v2"
log "github.com/sirupsen/logrus"
)
func initCKClient() *sql.DB {
log.Debug("start to initializing clickhouse client...")
conn := clickhouse.OpenDB(&clickhouse.Options{
Protocol: 1,
Addr: strings.Split(config.ClickHouseURL, ","),
Auth: clickhouse.Auth{
Database: config.ClickHouseDB,
Username: config.ClickHouseUser,
Password: config.ClickHousePassword,
},
Settings: clickhouse.Settings{
"max_execution_time": 600,
},
DialTimeout: 300 * time.Second,
Compression: &clickhouse.Compression{
Method: clickhouse.CompressionLZ4,
},
})
func (c *CKClientWrapper) GetCKData(productModule, instances string) map[string]models.DV {
log.Debug("Start to get data from clickhouse")
querySQL := ""
switch config.SysName {
case "XXX":
querySQL = getKafkaCKQuerySQL(username, productModule, instances)
}
log.Infof(querySQLLog, ipAddress, username, querySQL)
if querySQL == "" {
log.Error("CKQuerySQL is null")
return nil
}
log.Debugf("查询开始执行: %s", querySQL)
rows, err := c.DBClient.Query(querySQL)
if err != nil {
log.Errorf("query failed: %v", err)
log.Errorf("querySQL: %s", querySQL)
return nil
}
log.Debugf("Trying to connect to ClickHouse with URL: %v", config.ClickHouseURL)
return conn
}
Error log
[ms-clickhouse.go:207] [query failed: clickhouse [execute]:: 403 code: failed to read the response: read: read next block: data size should be 0 < 980316009 < 134217728]
Environment
- Go version: 1.23