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

clickhouse [execute]:: 403 code: failed to read the response: read: read next block: data size should be 0 < 980316009 < 134217728 #1442

Open
1 task
KD0735 opened this issue Nov 27, 2024 · 0 comments

Comments

@KD0735
Copy link

KD0735 commented Nov 27, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant