Repository navigation
Closed
Description
Description
There are several tests against local cluster failing. Problem usually in that tests read data too fast before it is on all cluster nodes. But something tells that it is configuration issue. Here is few examples of failed tests:
[ERROR] com.clickhouse.client.HttpTransportTests.testPasswordAuthentication[sha256_password, password, false](5) -- Time elapsed: 0.008 s <<< FAILURE!
java.lang.AssertionError: Failed on setup
at org.testng.Assert.fail(Assert.java:98)
at com.clickhouse.client.HttpTransportTests.testPasswordAuthentication(HttpTransportTests.java:1091)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:136)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:658)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:219)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:923)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:192)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:808)
at org.testng.TestRunner.run(TestRunner.java:603)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
at org.testng.SuiteRunner.run(SuiteRunner.java:326)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.runSuites(TestNG.java:1092)
at org.testng.TestNG.run(TestNG.java:1060)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:155)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:169)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:88)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:137)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: com.clickhouse.client.api.ServerException: Code: 493. DB::Exception: user `some_user`: cannot insert because user `some_user` already exists in `replicated`. (ACCESS_ENTITY_ALREADY_EXISTS) (version 26.10.3.7 (official build)) (queryId= 5c6ea623-7121-4f54-9b2b-cd4a8ed6c1d7)
at com.clickhouse.client.api.internal.HttpAPIClientHelper.readClickHouseError(HttpAPIClientHelper.java:534)
at com.clickhouse.client.api.internal.HttpAPIClientHelper.readError(HttpAPIClientHelper.java:426)
at com.clickhouse.client.api.internal.HttpAPIClientHelper.doExecuteRequest(HttpAPIClientHelper.java:833)
at com.clickhouse.client.api.internal.HttpAPIClientHelper.executeRequest(HttpAPIClientHelper.java:795)
at com.clickhouse.client.api.internal.HttpAPIClientHelper.executeRequest(HttpAPIClientHelper.java:772)
at com.clickhouse.client.api.Client.lambda$query$4(Client.java:2035)
at com.clickhouse.client.api.Client.runAsyncOperation(Client.java:2541)
at com.clickhouse.client.api.Client.query(Client.java:2081)
at com.clickhouse.client.api.Client.query(Client.java:1939)
at com.clickhouse.client.api.Client.execute(Client.java:2479)
at com.clickhouse.client.HttpTransportTests.testPasswordAuthentication(HttpTransportTests.java:1088)
... 33 more
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] HttpTransportTests.testPasswordAuthentication:1102 Failed to authenticate
[ERROR] HttpTransportTests.testPasswordAuthentication:1102 Failed to authenticate
[ERROR] HttpTransportTests.testPasswordAuthentication:1091 Failed on setup
What to do:
- review cluster configuration to speedup data transfer between nodes.
- check if is it enough resources for all cluster nodes - so limiting memory to fit setup on github free runner is needed
- No timeouts should be used. Fixing with
Thead.sleepdoesn't solve the problem just defers it to later time. As we have a lot tests it will drag us back fixing them over and over.
Activity
chernser commentedon Oct 29, 2026
@polyglotAI-bot please fix the issue. Read description carefully and create a short plan.
polyglotAI-bot commentedon Oct 29, 2026
Plan for this issue. I checked the cluster failures on
mainand reproduced the main one locally with the repo's own cluster configs (3 replicas + Keeper + nginx, CH 26.10.3.7).What fails on
main(cluster legs)HttpTransportTests.testPasswordAuthentication,ClientTests.testOperationCustomRoles/testClientCustomRoles(also Flaky test: client-v2 cluster legs — testOperationCustomRoles / testClientCustomRoles / testPasswordAuthentication use a new user or role before it reaches every replica #3237).CREATE TABLEhangs for 1800 s:RowBinaryFormatWriterTest.*(Flaky test: client-v2 cluster legs — insert right after CREATE TABLE hangs 1800 s with UNKNOWN_STATUS_OF_INSERT (quorum never reached) #3246).jdbc-v2 + CH cluster latest:testAllTableEnginesFromSystemTableEnginesAreMapped(newElasticsearchengine in 26.10). This is not cluster-specific. It also fails on the single-server leg and is already [jdbc-v2] Add new engine to the list #3265 / [jdbc-v2] Add RETURNING, SHARED keywords and Elasticsearch engine for ClickHouse HEAD #3274. Not in this plan.Cause of 1 (verified)
Each server keeps the users and roles from
<replicated>in an in-memory cache. Login, role lookup andDROP ... IF EXISTSread only this cache (ZooKeeperReplicator::findEntity). A Keeper watch thread updates the cache asynchronously. nginx sends each request to any server, so a request just afterCREATE USERcan go to a server that does not have the user yet.The error in the description is the same race.
DROP USER IF EXISTS some_userwent to a server whose cache did not have the user from the previous run, so it did nothing. ThenCREATE USERfound the user in Keeper and failed withACCESS_ENTITY_ALREADY_EXISTS.No server setting makes this synchronous. More CPU makes the window smaller, but does not close it.
Local results (create a user, then 3 logins through nginx):
SYSTEM RELOAD USERS ON CLUSTERACCESS_ENTITY_ALREADY_EXISTS)CREATE USER ... ON CLUSTERdoes not help. With replicated storage it fails withACCESS_ENTITY_ALREADY_EXISTSon the other servers (10/10).Plan
PR 1: a sync point after user/role changes (test code only)
BaseIntegrationTestthat runsSYSTEM RELOAD USERS ON CLUSTER 'test_cluster'on the cluster and does nothing on a single server.SYSTEM RELOAD USERSsyncs with Keeper and reads all users and roles again before it returns (ZooKeeperReplicator::reload). TheON CLUSTERquery returns only after all 3 servers did this. It takes about 0.2 s.PR 2: cluster resources (
containers/clickhouse-clusterand the container starter)system.query_log):metric_log,asynchronous_metric_log,trace_log,processors_profile_log,background_schedule_pool_log, and similar. Each of the 3 servers flushes and merges these tables all the time.Quorum hang (#3246): I found no setting that fixes it. It is a server race: a replica that is still cloning counts as active for the quorum, but the clone fetches the part without the quorum mark, so the quorum never completes. PR 2 makes the window smaller. A real fix must be in the server, so a human should report it to ClickHouse/ClickHouse.
Questions
SYSTEM RELOAD USERS ON CLUSTERsync point acceptable for PR 1?SYSTEM RELOAD USERSon Cloud). Is it OK to keep Cloud as it is for now?Neither PR changes
.github/workflowsor production code.chernser commentedon Oct 29, 2026
@polyglotAI-bot
PR 1 should use check instead of delay to verify user is synced across all replicas (do limited number of attempts). Here is SQL example
Also this PR should use unique user names if it doesn't matter for tests. In this case we make sure tests are verifying exact user not the one created by another tests.
All administrative commands should be avoided in tests because:
P2: completely what I think
Questions/Answers:
Please proceed
tests: turn off unused system logs and limit replica memory in the cl…
chernser commentedon Nov 2, 2026
Closed by #3285