Skip to content

Commit

Permalink
ci/cd failed issue (#187)
Browse files Browse the repository at this point in the history
* fix: clickhouse query issue

* fix: make systest
  • Loading branch information
YenchangChan committed Jan 2, 2024
1 parent e21fa86 commit 5ba6308
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions go.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ sudo docker exec kafka kafka-topics --bootstrap-server localhost:9093 --topic to
sudo docker exec kafka sh /tmp/send.sh

echo "start clickhouse_sinker to consume"
timeout 30 ./clickhouse_sinker --local-cfg-file docker/test_fixed_schema.hjson
timeout 30 ./clickhouse_sinker --local-cfg-file docker/test_auto_schema.hjson
timeout 60 ./clickhouse_sinker --local-cfg-file docker/test_dynamic_schema.hjson
timeout 30 ./bin/clickhouse_sinker --local-cfg-file docker/test_fixed_schema.hjson
timeout 30 ./bin/clickhouse_sinker --local-cfg-file docker/test_auto_schema.hjson
timeout 60 ./bin/clickhouse_sinker --local-cfg-file docker/test_dynamic_schema.hjson

echo "check result 1"
count=`curl "localhost:8123" -d 'select count() from test_fixed_schema'`
Expand All @@ -75,19 +75,19 @@ curl "localhost:8123" -d 'TRUNCATE TABLE test_auto_schema'
curl "localhost:8123" -d 'TRUNCATE TABLE test_dynamic_schema'

echo "publish clickhouse_sinker config"
./nacos_publish_config --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_fixed_schema --local-cfg-file docker/test_fixed_schema.hjson
./nacos_publish_config --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_auto_schema --local-cfg-file docker/test_auto_schema.hjson
./nacos_publish_config --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_dynamic_schema --local-cfg-file docker/test_dynamic_schema.hjson
./bin/nacos_publish_config --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_fixed_schema --local-cfg-file docker/test_fixed_schema.hjson
./bin/nacos_publish_config --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_auto_schema --local-cfg-file docker/test_auto_schema.hjson
./bin/nacos_publish_config --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_dynamic_schema --local-cfg-file docker/test_dynamic_schema.hjson

echo "start clickhouse_sinker to consume"
sudo docker exec kafka kafka-consumer-groups --bootstrap-server localhost:9093 --execute --reset-offsets --group test_fixed_schema --all-topics --to-earliest
timeout 30 ./clickhouse_sinker --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_fixed_schema
timeout 30 ./bin/clickhouse_sinker --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_fixed_schema

sudo docker exec kafka kafka-consumer-groups --bootstrap-server localhost:9093 --execute --reset-offsets --group test_auto_schema --all-topics --to-earliest
timeout 30 ./clickhouse_sinker --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_auto_schema
timeout 30 ./bin/clickhouse_sinker --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_auto_schema

sudo docker exec kafka kafka-consumer-groups --bootstrap-server localhost:9093 --execute --reset-offsets --group test_dynamic_schema --all-topics --to-earliest
timeout 30 ./clickhouse_sinker --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_dynamic_schema
timeout 30 ./bin/clickhouse_sinker --nacos-addr 127.0.0.1:8848 --nacos-username nacos --nacos-password nacos --nacos-dataid test_dynamic_schema

echo "check result 2"
count=`curl "localhost:8123" -d 'select count() from test_fixed_schema'`
Expand Down
12 changes: 6 additions & 6 deletions pool/ck_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ func (c *Conn) Query(query string, args ...any) (*Rows, error) {
var rs Rows
rs.protocol = c.protocol
if c.protocol == clickhouse.HTTP {
rows, err := c.db.Query(query, args)
rows, err := c.db.Query(query, args...)
if err != nil {
return &rs, err
} else {
rs.rs1 = rows
}
} else {
rows, err := c.c.Query(c.ctx, query, args)
rows, err := c.c.Query(c.ctx, query, args...)
if err != nil {
return &rs, err
} else {
Expand All @@ -98,19 +98,19 @@ func (c *Conn) QueryRow(query string, args ...any) *Row {
var row Row
row.proto = c.protocol
if c.protocol == clickhouse.HTTP {
row.r1 = c.db.QueryRow(query, args)
row.r1 = c.db.QueryRow(query, args...)
} else {
row.r2 = c.c.QueryRow(c.ctx, query, args)
row.r2 = c.c.QueryRow(c.ctx, query, args...)
}
return &row
}

func (c *Conn) Exec(query string, args ...any) error {
if c.protocol == clickhouse.HTTP {
_, err := c.db.Exec(query, args)
_, err := c.db.Exec(query, args...)
return err
} else {
return c.c.Exec(c.ctx, query, args)
return c.c.Exec(c.ctx, query, args...)
}
}

Expand Down

0 comments on commit 5ba6308

Please sign in to comment.