fix: ClickHouse insertion using native clickhouse-go/v2 API
Some checks failed
Build and Test / test (push) Has been cancelled
Build and Test / build (push) Has been cancelled
Build and Test / docker (push) Has been cancelled

- Replace database/sql wrapper with clickhouse.Open() and clickhouse.Conn
- Use PrepareBatch + Append + Send pattern for proper batch inserts
- Fix ATTEMPT_TO_READ_AFTER_EOF errors caused by empty VALUES
- Add batch size logging for debugging
- Update version to 1.1.5

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
toto
2026-03-03 11:38:33 +01:00
parent 4b4ab84ee0
commit d78cc52a88
4 changed files with 52 additions and 41 deletions

View File

@ -23,8 +23,7 @@ RUN go mod download || true
COPY . .
# Run tests with coverage (fail if < 80%)
RUN --mount=type=cache,target=/root/.cache/go-build \
go test -race -coverprofile=coverage.txt -covermode=atomic ./... && \
RUN go test -race -coverprofile=coverage.txt -covermode=atomic ./... && \
echo "=== Coverage Report ===" && \
go tool cover -func=coverage.txt | grep total && \
TOTAL=$(go tool cover -func=coverage.txt | grep total | awk '{gsub(/%/, "", $3); print $3}') && \
@ -36,8 +35,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
echo "Coverage check passed!"
# Build binary
RUN --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-w -s" \
-o /usr/bin/logcorrelator \
./cmd/logcorrelator