ClickHouse / ClickHouse/clickhouse-java

User Agent is not being added properly to all queries

Đang mở
#2,622 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug client-api-v2
Ngôn ngữ chính
Java
Star
1.6k
Fork
637
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
29

Mô tả

Description

Steps to reproduce
  1. Create the following table:
CREATE TABLE default.example_table
(
    `id` Int32,
    `name` String
)
ENGINE = MergeTree
ORDER BY id
SETTINGS index_granularity = 8192
  1. Run the following JDBC code:
package com.google.cloud.teleport.v2;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class JDBCMain {
    private static final Logger log = LoggerFactory.getLogger(JDBCMain.class);
    static final String TABLE_NAME = "default.example_table";

    public static void main(String[] args) throws Exception {
        String url = System.getProperty("chUrl", "jdbc:ch://localhost:8123?client_name=thisisatest");

        // Set user and password if needed
        Properties properties = new Properties();
        properties.setProperty("user", System.getProperty("chUser", "default"));
        properties.setProperty("password", System.getProperty("chPassword", "123456"));


        printInsertedData(url, properties);


    }


    static void printInsertedData(String url, Properties properties) throws SQLException {
        try (Connection conn = DriverManager.getConnection(url, properties)) {//Grab a connection using the jdbc DriverManager
            try (Statement stmt = conn.createStatement()) {
                try (ResultSet rs = stmt.executeQuery("SELECT * FROM " + TABLE_NAME)) {
                    while (rs.next()) {
                        //Print the values of the current row
                        log.info(rs.getString(1));
                        log.info(rs.getString(2));
                    }
                }
            }
        }
    }

}
Error Log or Exception StackTrace

When querying the query_log table, we get the following data. The full result is attached as a CSV.

Image

I verified that all these queries are related to the same "batch".

jdbc_user_agent_issue.csv

Expected Behaviour

The client_name should be applied to all related queries, including internal queries being fired by the client.

Client Configuration

Added as a connection string in the example above.

Environment
  • Client version: 0.9.2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với việc thiết lập kết nối JDBCMain và tái hiện SELECT trong khi kiểm tra query_log và CSV đính kèm. Theo dõi cách client_name được truyền đến các truy vấn chính và truy vấn nội bộ; công việc được xem là hoàn tất khi mọi truy vấn trong cùng một batch đều mang client_name đã cấu hình. Issue không nêu tên tệp nào trong repository hay test nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, sql
Lĩnh vực
backend, databases
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.