mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
fix: Use host_name instead of host_address for ClickhouseCluster node discovery (#29152)
This commit is contained in:
4
.github/actions/run-backend-tests/action.yml
vendored
4
.github/actions/run-backend-tests/action.yml
vendored
@@ -41,9 +41,9 @@ runs:
|
||||
docker compose -f docker-compose.dev.yml down
|
||||
docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
- name: Add Kafka to /etc/hosts
|
||||
- name: Add Kafka and ClickHouse to /etc/hosts
|
||||
shell: bash
|
||||
run: echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
|
||||
run: echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
|
||||
4
.github/workflows/ci-backend.yml
vendored
4
.github/workflows/ci-backend.yml
vendored
@@ -363,8 +363,8 @@ jobs:
|
||||
run: |
|
||||
uv pip install --system -r requirements.txt -r requirements-dev.txt
|
||||
|
||||
- name: Add kafka host to /etc/hosts for kafka connectivity
|
||||
run: sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
|
||||
- name: Add Kafka and ClickHouse to /etc/hosts
|
||||
run: sudo echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Set up needed files
|
||||
run: |
|
||||
|
||||
2
.github/workflows/ci-e2e-playwright.yml
vendored
2
.github/workflows/ci-e2e-playwright.yml
vendored
@@ -176,7 +176,7 @@ jobs:
|
||||
mkdir -p /tmp/logs
|
||||
|
||||
echo "Starting PostHog using the container image ${{ needs.container.outputs.tag }}"
|
||||
DOCKER_RUN="docker run --rm --network host --add-host kafka:127.0.0.1 --env-file .env ${{ needs.container.outputs.tag }}"
|
||||
DOCKER_RUN="docker run --rm --network host --add-host kafka:127.0.0.1 --add-host clickhouse:127.0.0.1 --env-file .env ${{ needs.container.outputs.tag }}"
|
||||
|
||||
$DOCKER_RUN ./bin/migrate
|
||||
$DOCKER_RUN python manage.py setup_dev
|
||||
|
||||
2
.github/workflows/ci-e2e.yml
vendored
2
.github/workflows/ci-e2e.yml
vendored
@@ -228,7 +228,7 @@ jobs:
|
||||
mkdir -p /tmp/logs
|
||||
|
||||
echo "Starting PostHog using the container image ${{ needs.container.outputs.tag }}"
|
||||
DOCKER_RUN="docker run --rm --network host --add-host kafka:127.0.0.1 --env-file .env ${{ needs.container.outputs.tag }}"
|
||||
DOCKER_RUN="docker run --rm --network host --add-host kafka:127.0.0.1 --add-host clickhouse:127.0.0.1 --env-file .env ${{ needs.container.outputs.tag }}"
|
||||
|
||||
$DOCKER_RUN ./bin/migrate
|
||||
$DOCKER_RUN python manage.py setup_dev
|
||||
|
||||
8
.github/workflows/ci-plugin-server.yml
vendored
8
.github/workflows/ci-plugin-server.yml
vendored
@@ -105,9 +105,9 @@ jobs:
|
||||
docker compose -f docker-compose.dev.yml down
|
||||
docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
- name: Add Kafka to /etc/hosts
|
||||
- name: Add Kafka and ClickHouse to /etc/hosts
|
||||
if: needs.changes.outputs.plugin-server == 'true'
|
||||
run: echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
|
||||
run: echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Set up Python
|
||||
if: needs.changes.outputs.plugin-server == 'true'
|
||||
@@ -216,9 +216,9 @@ jobs:
|
||||
docker compose -f docker-compose.dev.yml down
|
||||
docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
- name: Add Kafka to /etc/hosts
|
||||
- name: Add Kafka and ClickHouse to /etc/hosts
|
||||
if: needs.changes.outputs.plugin-server == 'true'
|
||||
run: echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
|
||||
run: echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Set up Python
|
||||
if: needs.changes.outputs.plugin-server == 'true'
|
||||
|
||||
4
.github/workflows/rust.yml
vendored
4
.github/workflows/rust.yml
vendored
@@ -109,14 +109,14 @@ jobs:
|
||||
run: |
|
||||
docker compose -f ../docker-compose.dev.yml down
|
||||
docker compose -f ../docker-compose.dev.yml up -d
|
||||
echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Setup dependencies
|
||||
if: needs.changes.outputs.rust == 'true' && matrix.package == 'others'
|
||||
run: |
|
||||
docker compose up kafka redis db echo_server objectstorage -d --wait
|
||||
docker compose up setup_test_db
|
||||
echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
|
||||
echo "127.0.0.1 kafka clickhouse" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Install rust
|
||||
if: needs.changes.outputs.rust == 'true'
|
||||
|
||||
@@ -79,11 +79,11 @@ class FuturesMap(dict[K, Future[V]]):
|
||||
|
||||
|
||||
class ConnectionInfo(NamedTuple):
|
||||
address: str
|
||||
host: str
|
||||
port: int | None
|
||||
|
||||
def make_pool(self, client_settings: Mapping[str, str] | None = None) -> ChPool:
|
||||
return _make_ch_pool(host=self.address, port=self.port, settings=client_settings)
|
||||
return _make_ch_pool(host=self.host, port=self.port, settings=client_settings)
|
||||
|
||||
|
||||
class HostInfo(NamedTuple):
|
||||
@@ -114,7 +114,7 @@ class ClickhouseCluster:
|
||||
|
||||
cluster_hosts = bootstrap_client.execute(
|
||||
"""
|
||||
SELECT host_address, port, shard_num, replica_num, getMacro('hostClusterType') as host_cluster_type, getMacro('hostClusterRole') as host_cluster_role
|
||||
SELECT host_name, port, shard_num, replica_num, getMacro('hostClusterType') as host_cluster_type, getMacro('hostClusterRole') as host_cluster_role
|
||||
FROM clusterAllReplicas(%(name)s, system.clusters)
|
||||
WHERE name = %(name)s and is_local
|
||||
ORDER BY shard_num, replica_num
|
||||
@@ -123,10 +123,10 @@ class ClickhouseCluster:
|
||||
)
|
||||
|
||||
for row in cluster_hosts:
|
||||
(host_address, port, shard_num, replica_num, host_cluster_type, host_cluster_role) = row
|
||||
(host_name, port, shard_num, replica_num, host_cluster_type, host_cluster_role) = row
|
||||
host_info = HostInfo(
|
||||
ConnectionInfo(
|
||||
host_address,
|
||||
host_name,
|
||||
# We only use the port from system.clusters if we're running in E2E tests or debug mode,
|
||||
# otherwise, we will use the default port.
|
||||
port=port if (settings.E2E_TESTING or settings.DEBUG) else None,
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
'''
|
||||
1 future(s) did not return a result:
|
||||
|
||||
* HostInfo(connection_info=ConnectionInfo(address='127.0.0.1', port=9000), shard_num=1, replica_num=1, host_cluster_type='online', host_cluster_role='data'): ServerException("DB::Exception: Syntax error: failed at position 1 ('invalid'): invalid query. Expected one of: Query, Query with output, EXPLAIN, EXPLAIN, SELECT query, possibly with UNION, list of union elements, SELECT query, subquery, possibly with UNI...
|
||||
* HostInfo(connection_info=ConnectionInfo(host='clickhouse', port=9000), shard_num=1, replica_num=1, host_cluster_type='online', host_cluster_role='data'): ServerException("DB::Exception: Syntax error: failed at position 1 ('invalid'): invalid query. Expected one of: Query, Query with output, EXPLAIN, EXPLAIN, SELECT query, possibly with UNION, list of union elements, SELECT query, subquery, possibly with UNI...
|
||||
'''
|
||||
# ---
|
||||
# name: test_exception_summary.1
|
||||
'''
|
||||
1 future(s) did not return a result:
|
||||
|
||||
* HostInfo(connection_info=ConnectionInfo(address='127.0.0.1', port=9000), shard_num=1, replica_num=1, host_cluster_type='online', host_cluster_role='data'): ServerException("DB::Exception: Unknown table expression identifier 'invalid_table_name' in scope SELECT * FROM invalid_table_name. Stack trace:\n\n0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000000000000\n1. DB::Exceptio...
|
||||
* HostInfo(connection_info=ConnectionInfo(host='clickhouse', port=9000), shard_num=1, replica_num=1, host_cluster_type='online', host_cluster_role='data'): ServerException("DB::Exception: Unknown table expression identifier 'invalid_table_name' in scope SELECT * FROM invalid_table_name. Stack trace:\n\n0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000000000000\n1. DB::Exceptio...
|
||||
'''
|
||||
# ---
|
||||
# name: test_exception_summary.2
|
||||
'''
|
||||
1 future(s) did not return a result:
|
||||
|
||||
* HostInfo(connection_info=ConnectionInfo(address='127.0.0.1', port=9000), shard_num=1, replica_num=1, host_cluster_type='online', host_cluster_role='data'): ValueError('custom error')
|
||||
* HostInfo(connection_info=ConnectionInfo(host='clickhouse', port=9000), shard_num=1, replica_num=1, host_cluster_type='online', host_cluster_role='data'): ValueError('custom error')
|
||||
'''
|
||||
# ---
|
||||
|
||||
Reference in New Issue
Block a user