Skip to content

Commit 6d4d9ac

Browse files
authored
Merge pull request #79 from IvanOfThings/78-bug-remote-privilege-causes-infinite-state-drift-and-syntax-error
🐛 fixing bug when updating privileges
2 parents 2632095 + 234a7c2 commit 6d4d9ac

9 files changed

Lines changed: 883 additions & 24 deletions

File tree

docker-compose.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
services:
2+
# ZooKeeper for cluster coordination
3+
zookeeper:
4+
image: zookeeper:3.8
5+
container_name: clickhouse-zookeeper
6+
hostname: zookeeper
7+
ports:
8+
- "2181:2181"
9+
environment:
10+
ZOO_MY_ID: 1
11+
ZOO_SERVERS: server.1=zookeeper:2888:3888;2181
12+
volumes:
13+
- zookeeper-data:/data
14+
- zookeeper-logs:/datalog
15+
networks:
16+
- clickhouse-network
17+
healthcheck:
18+
test: ["CMD", "nc", "-z", "localhost", "2181"]
19+
interval: 10s
20+
timeout: 5s
21+
retries: 5
22+
23+
# ClickHouse Node 1 (Shard 1, Replica 1)
24+
clickhouse-01:
25+
image: clickhouse/clickhouse-server:latest
26+
container_name: clickhouse-01
27+
hostname: clickhouse-01
28+
ports:
29+
- "8123:8123" # HTTP interface
30+
- "9000:9000" # Native protocol (used by provider)
31+
- "9009:9009" # Inter-server communication
32+
environment:
33+
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
34+
volumes:
35+
- clickhouse-01-data:/var/lib/clickhouse
36+
- ./docker/clickhouse-01/config.d:/etc/clickhouse-server/config.d
37+
depends_on:
38+
zookeeper:
39+
condition: service_healthy
40+
networks:
41+
- clickhouse-network
42+
healthcheck:
43+
test: ["CMD", "clickhouse-client", "--query=SELECT 1"]
44+
interval: 15s
45+
timeout: 5s
46+
retries: 5
47+
start_period: 30s
48+
49+
# ClickHouse Node 2 (Shard 2, Replica 1)
50+
clickhouse-02:
51+
image: clickhouse/clickhouse-server:latest
52+
container_name: clickhouse-02
53+
hostname: clickhouse-02
54+
ports:
55+
- "8124:8123" # HTTP interface
56+
- "9001:9000" # Native protocol
57+
- "9010:9009" # Inter-server communication
58+
environment:
59+
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
60+
volumes:
61+
- clickhouse-02-data:/var/lib/clickhouse
62+
- ./docker/clickhouse-02/config.d:/etc/clickhouse-server/config.d
63+
depends_on:
64+
zookeeper:
65+
condition: service_healthy
66+
networks:
67+
- clickhouse-network
68+
healthcheck:
69+
test: ["CMD", "clickhouse-client", "--query=SELECT 1"]
70+
interval: 15s
71+
timeout: 5s
72+
retries: 5
73+
start_period: 30s
74+
75+
volumes:
76+
zookeeper-data:
77+
driver: local
78+
zookeeper-logs:
79+
driver: local
80+
clickhouse-01-data:
81+
driver: local
82+
clickhouse-02-data:
83+
driver: local
84+
85+
networks:
86+
clickhouse-network:
87+
driver: bridge
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0"?>
2+
<clickhouse>
3+
<!-- Cluster configuration -->
4+
<remote_servers>
5+
<test_cluster>
6+
<!-- Shard 1 -->
7+
<shard>
8+
<replica>
9+
<host>clickhouse-01</host>
10+
<port>9000</port>
11+
</replica>
12+
</shard>
13+
<!-- Shard 2 -->
14+
<shard>
15+
<replica>
16+
<host>clickhouse-02</host>
17+
<port>9000</port>
18+
</replica>
19+
</shard>
20+
</test_cluster>
21+
</remote_servers>
22+
23+
<!-- ZooKeeper configuration -->
24+
<zookeeper>
25+
<node>
26+
<host>zookeeper</host>
27+
<port>2181</port>
28+
</node>
29+
</zookeeper>
30+
31+
<!-- Distributed DDL -->
32+
<distributed_ddl>
33+
<path>/clickhouse/task_queue/ddl</path>
34+
</distributed_ddl>
35+
36+
<!-- Macros for Node 1 -->
37+
<macros>
38+
<cluster>test_cluster</cluster>
39+
<shard>01</shard>
40+
<replica>01</replica>
41+
</macros>
42+
43+
<!-- Allow listening on all interfaces -->
44+
<listen_host>0.0.0.0</listen_host>
45+
46+
<!-- Inter-server communication -->
47+
<interserver_http_host>clickhouse-01</interserver_http_host>
48+
<interserver_http_port>9009</interserver_http_port>
49+
</clickhouse>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0"?>
2+
<clickhouse>
3+
<!-- Cluster configuration -->
4+
<remote_servers>
5+
<test_cluster>
6+
<!-- Shard 1 -->
7+
<shard>
8+
<replica>
9+
<host>clickhouse-01</host>
10+
<port>9000</port>
11+
</replica>
12+
</shard>
13+
<!-- Shard 2 -->
14+
<shard>
15+
<replica>
16+
<host>clickhouse-02</host>
17+
<port>9000</port>
18+
</replica>
19+
</shard>
20+
</test_cluster>
21+
</remote_servers>
22+
23+
<!-- ZooKeeper configuration -->
24+
<zookeeper>
25+
<node>
26+
<host>zookeeper</host>
27+
<port>2181</port>
28+
</node>
29+
</zookeeper>
30+
31+
<!-- Distributed DDL -->
32+
<distributed_ddl>
33+
<path>/clickhouse/task_queue/ddl</path>
34+
</distributed_ddl>
35+
36+
<!-- Macros for Node 2 -->
37+
<macros>
38+
<cluster>test_cluster</cluster>
39+
<shard>02</shard>
40+
<replica>01</replica>
41+
</macros>
42+
43+
<!-- Allow listening on all interfaces -->
44+
<listen_host>0.0.0.0</listen_host>
45+
46+
<!-- Inter-server communication -->
47+
<interserver_http_host>clickhouse-02</interserver_http_host>
48+
<interserver_http_port>9009</interserver_http_port>
49+
</clickhouse>

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/hashicorp/terraform-plugin-log v0.7.0
1313
github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0
1414
github.com/joho/godotenv v1.4.0
15+
github.com/stretchr/testify v1.8.4
1516
)
1617

1718
require (
@@ -66,6 +67,7 @@ require (
6667
github.com/paulmach/orb v0.10.0 // indirect
6768
github.com/pierrec/lz4/v4 v4.1.18 // indirect
6869
github.com/pkg/errors v0.9.1 // indirect
70+
github.com/pmezard/go-difflib v1.0.0 // indirect
6971
github.com/posener/complete v1.2.3 // indirect
7072
github.com/russross/blackfriday v1.6.0 // indirect
7173
github.com/segmentio/asm v1.2.0 // indirect

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
240240
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
241241
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
242242
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
243+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
243244
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
244245
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
245246
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=

0 commit comments

Comments
 (0)