diff --git a/.github/workflows/node-clickhouse-cluster.js.yml b/.github/workflows/node-clickhouse-cluster.js.yml
new file mode 100644
index 00000000..9abec8cf
--- /dev/null
+++ b/.github/workflows/node-clickhouse-cluster.js.yml
@@ -0,0 +1,56 @@
+# This workflow will validate qryn using nodejs + clickhouse
+
+name: QRYN CI
+
+on:
+ push:
+ branches: [ master, beta ]
+ paths-ignore:
+ - '**.md'
+ - '**.yml'
+ - '**.yaml'
+ pull_request:
+ branches: [ master, beta ]
+ paths-ignore:
+ - '**.md'
+ - '**.yml'
+ - '**.yaml'
+ workflow_dispatch:
+ inputs:
+ clickhouse_tag:
+ description: 'Tag for ClickHouse (23.8-alpine)'
+ required: false
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: [18, 16.x, 20]
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
+ steps:
+ - uses: actions/checkout@v4
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v4.0.0
+ with:
+ node-version: ${{ matrix.node-version }}
+ cache: 'npm'
+ - run: npm install
+ - run: npm run postinstall
+ - run: git submodule init
+ - run: git submodule update
+ - run: docker-compose -f docker/e2e/docker-compose-cluster.yaml up -d
+ - run: sleep 5
+ - name: Workflow Telemetry
+ uses: runforesight/workflow-telemetry-action@v1.8.7
+ - env:
+ CLUSTER_NAME: test_cluster_two_shards
+ CLICKHOUSE_DB: qryn
+ CLICKHOUSE_TSDB: qryn
+ run: node qryn.mjs >/dev/stdout &
+ - env:
+ CLICKHOUSE_DB: qryn
+ CLICKHOUSE_TSDB: qryn
+ INTEGRATION_E2E: 1
+ CLOKI_EXT_URL: 127.0.0.1:3100
+ run: npm run test --forceExit
diff --git a/docker/e2e/config.xml b/docker/e2e/config.xml
new file mode 100644
index 00000000..3020ed6d
--- /dev/null
+++ b/docker/e2e/config.xml
@@ -0,0 +1,1210 @@
+
+
+
+
+
+ error
+ 1
+
+ 1000M
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 8123
+
+
+ 9000
+
+
+ 9004
+
+
+ 9005
+
+
+
+
+
+
+
+
+
+
+
+ 9009
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 4096
+
+
+ 3
+
+
+
+
+ false
+
+
+ /path/to/ssl_cert_file
+ /path/to/ssl_key_file
+
+
+ false
+
+
+ /path/to/ssl_ca_cert_file
+
+
+ none
+
+
+ 0
+
+
+ -1
+ -1
+
+
+ false
+
+
+
+
+
+
+ /etc/clickhouse-server/server.crt
+ /etc/clickhouse-server/server.key
+
+
+ none
+ true
+ true
+ sslv2,sslv3
+ true
+
+
+
+ true
+ true
+ sslv2,sslv3
+ true
+
+
+
+ RejectCertificateHandler
+
+
+
+
+
+
+
+
+ 100
+
+
+ 0
+
+
+
+ 10000
+
+
+
+
+
+ 0.9
+
+
+ 4194304
+
+
+ 0
+
+
+
+
+
+ 8589934592
+
+
+ 5368709120
+
+
+
+ 1000
+
+
+ 134217728
+
+
+ 10000
+
+
+ /var/lib/clickhouse/
+
+
+ /var/lib/clickhouse/tmp/
+
+
+
+ `
+
+
+
+
+
+ /var/lib/clickhouse/user_files/
+
+
+
+
+
+
+
+
+
+
+
+
+ users.xml
+
+
+
+ /var/lib/clickhouse/access/
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+ ' | sed -e 's|.*>\(.*\)<.*|\1|')
+ wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb
+ apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb
+ clickhouse-jdbc-bridge &
+
+ * [CentOS/RHEL]
+ export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge
+ export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|')
+ wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm
+ yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm
+ clickhouse-jdbc-bridge &
+
+ Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information.
+ ]]>
+
+
+
+
+
+
+
+ clickhouse.cloki.deploy
+ 9000
+
+
+
+
+ clickhouse2.cloki.deploy
+ 9000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3600
+
+
+
+ 3600
+
+
+ 60
+
+
+
+
+
+
+
+
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+
+
+
+
+
+ 7500
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+
+
+ system
+
+ 7500
+ 1000
+
+
+
+
+ system
+
+
+ 7000
+
+
+
+
+
+
+ engine MergeTree
+ partition by toYYYYMM(finish_date)
+ order by (finish_date, finish_time_us, trace_id)
+
+ system
+
+ 7500
+
+
+
+
+
+ system
+
+
+
+ 1000
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *_dictionary.xml
+
+
+ *_function.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2181
+ 1
+ /var/lib/clickhouse/coordination/log
+ /var/lib/clickhouse/coordination/snapshots
+
+
+ 10000
+ 30000
+ trace
+
+
+
+
+ 1
+ clickhouse.cloki.deploy
+ 9444
+
+
+ 2
+ clickhouse2.cloki.deploy
+ 9444
+
+
+
+
+
+
+ clickhouse.cloki.deploy
+ 2181
+
+
+ clickhouse2.cloki.deploy
+ 2181
+
+
+
+ 1
+ replica_1
+
+
+
+
+
+ /clickhouse/task_queue/ddl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ click_cost
+ any
+
+ 0
+ 3600
+
+
+ 86400
+ 60
+
+
+
+ max
+
+ 0
+ 60
+
+
+ 3600
+ 300
+
+
+ 86400
+ 3600
+
+
+
+
+
+ /var/lib/clickhouse/format_schemas/
+
+
+
+
+ hide encrypt/decrypt arguments
+ ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\)
+
+ \1(???)
+
+
+
+
+
+
+
+
+
+ false
+
+ false
+
+
+ https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277
+
+
+
+
+
+
+
+
diff --git a/docker/e2e/config2.xml b/docker/e2e/config2.xml
new file mode 100644
index 00000000..9d047207
--- /dev/null
+++ b/docker/e2e/config2.xml
@@ -0,0 +1,1210 @@
+
+
+
+
+
+ error
+ 1
+
+ 1000M
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 8123
+
+
+ 9000
+
+
+ 9004
+
+
+ 9005
+
+
+
+
+
+
+
+
+
+
+
+ 9009
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 4096
+
+
+ 3
+
+
+
+
+ false
+
+
+ /path/to/ssl_cert_file
+ /path/to/ssl_key_file
+
+
+ false
+
+
+ /path/to/ssl_ca_cert_file
+
+
+ none
+
+
+ 0
+
+
+ -1
+ -1
+
+
+ false
+
+
+
+
+
+
+ /etc/clickhouse-server/server.crt
+ /etc/clickhouse-server/server.key
+
+
+ none
+ true
+ true
+ sslv2,sslv3
+ true
+
+
+
+ true
+ true
+ sslv2,sslv3
+ true
+
+
+
+ RejectCertificateHandler
+
+
+
+
+
+
+
+
+ 100
+
+
+ 0
+
+
+
+ 10000
+
+
+
+
+
+ 0.9
+
+
+ 4194304
+
+
+ 0
+
+
+
+
+
+ 8589934592
+
+
+ 5368709120
+
+
+
+ 1000
+
+
+ 134217728
+
+
+ 10000
+
+
+ /var/lib/clickhouse/
+
+
+ /var/lib/clickhouse/tmp/
+
+
+
+ `
+
+
+
+
+
+ /var/lib/clickhouse/user_files/
+
+
+
+
+
+
+
+
+
+
+
+
+ users.xml
+
+
+
+ /var/lib/clickhouse/access/
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+ ' | sed -e 's|.*>\(.*\)<.*|\1|')
+ wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb
+ apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb
+ clickhouse-jdbc-bridge &
+
+ * [CentOS/RHEL]
+ export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge
+ export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|')
+ wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm
+ yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm
+ clickhouse-jdbc-bridge &
+
+ Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information.
+ ]]>
+
+
+
+
+
+
+
+ clickhouse.cloki.deploy
+ 9000
+
+
+
+
+ clickhouse2.cloki.deploy
+ 9000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3600
+
+
+
+ 3600
+
+
+ 60
+
+
+
+
+
+
+
+
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+
+
+
+
+
+ 7500
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+
+
+ system
+
+ 7500
+ 1000
+
+
+
+
+ system
+
+
+ 7000
+
+
+
+
+
+
+ engine MergeTree
+ partition by toYYYYMM(finish_date)
+ order by (finish_date, finish_time_us, trace_id)
+
+ system
+
+ 7500
+
+
+
+
+
+ system
+
+
+
+ 1000
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *_dictionary.xml
+
+
+ *_function.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2181
+ 2
+ /var/lib/clickhouse/coordination/log
+ /var/lib/clickhouse/coordination/snapshots
+
+
+ 10000
+ 30000
+ trace
+
+
+
+
+ 1
+ clickhouse.cloki.deploy
+ 9444
+
+
+ 2
+ clickhouse2.cloki.deploy
+ 9444
+
+
+
+
+
+
+ clickhouse.cloki.deploy
+ 2181
+
+
+ clickhouse2.cloki.deploy
+ 2181
+
+
+
+ 2
+ replica_1
+
+
+
+
+
+ /clickhouse/task_queue/ddl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ click_cost
+ any
+
+ 0
+ 3600
+
+
+ 86400
+ 60
+
+
+
+ max
+
+ 0
+ 60
+
+
+ 3600
+ 300
+
+
+ 86400
+ 3600
+
+
+
+
+
+ /var/lib/clickhouse/format_schemas/
+
+
+
+
+ hide encrypt/decrypt arguments
+ ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\)
+
+ \1(???)
+
+
+
+
+
+
+
+
+
+ false
+
+ false
+
+
+ https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277
+
+
+
+
+
+
+
+
diff --git a/docker/e2e/docker-compose-cluster.yaml b/docker/e2e/docker-compose-cluster.yaml
new file mode 100644
index 00000000..c1526979
--- /dev/null
+++ b/docker/e2e/docker-compose-cluster.yaml
@@ -0,0 +1,41 @@
+version: '2.1'
+networks:
+ common:
+ driver: bridge
+
+services:
+ clickhouse_1:
+ image: clickhouse/clickhouse-server:23.8
+ container_name: clickhouse.cloki.deploy
+ hostname: clickhouse.cloki.deploy
+ domainname: clickhouse.cloki.deploy
+ restart: unless-stopped
+ networks:
+ common:
+ aliases:
+ - "clickhouse_1"
+ expose:
+ - "9000"
+ - "2181"
+ - "9444"
+ ports:
+ - 9000:9000
+ - 8123:8123
+ volumes:
+ - ./config.xml:/etc/clickhouse-server/config.xml
+ clickhouse_2:
+ image: clickhouse/clickhouse-server:23.8
+ container_name: clickhouse2.cloki.deploy
+ hostname: clickhouse2.cloki.deploy
+ domainname: clickhouse2.cloki.deploy
+ restart: unless-stopped
+ networks:
+ common:
+ aliases:
+ - "clickhouse_2"
+ expose:
+ - "9000"
+ - "2181"
+ - "9444"
+ volumes:
+ - ./config2.xml:/etc/clickhouse-server/config.xml