ClickHouse/programs/copier
Azat Khuzhin ff324fe81a Fix fault injection in copier (wrong query syntax)
There are very frequent flakiness of `test_cluster_copier` test, here is
an example of copier failures on CI [1]:

    AssertionError: Instance: s0_1_0 (172.16.29.9). Info: {'ID': '5d68dcb46fdb4b0c54b7c7ba1ddde83b8f34d483bbb32abcb0c52b966444ce82', 'Running': False, 'ExitCode': 85, 'ProcessConfig': {'tty': False, 'entrypoint': '/usr/bin/clickhouse', 'arguments': ['copier', '--config', '/etc/clickhouse-server/config-copier.xml', '--task-path', '/clickhouse-copier/task_simple_4DFWYTDD49', '--task-file', '/task0_description.xml', '--task-upload-force', 'true', '--base-dir', '/var/log/clickhouse-server/copier', '--copy-fault-probability', '0.2', '--experimental-use-sample-offset', '1'], 'privileged': False, 'user': '0'}, 'OpenStdin': False, 'OpenStderr': True, 'OpenStdout': True, 'CanRemove': False, 'ContainerID': 'f356df6694b3cc09ee9830c623681626f8e8d999677c188b9fe911aa702784ca', 'DetachKeys': '', 'Pid': 84332}
    assert 85 == 0

But let's look what the error it is, apparently it is UNFINISHED:

    SELECT
        name,
        code
    FROM system.errors
    WHERE ((code % 256) = 85) AND (NOT remote)
    SETTINGS system_events_show_zero_values = 1

    ┌─name─────────────────────────────┬─code─┐
    │ FORMAT_IS_NOT_SUITABLE_FOR_INPUT │   85 │
    │ UNFINISHED                       │  341 │
    │ NO_SUCH_ERROR_CODE               │  597 │
    └──────────────────────────────────┴──────┘

Let's verify:

    $ grep -r UNFINISHED ./test_cluster_copier/_instances_0/s0_1_0/logs/copier/clickhouse-copier_*
    ./test_cluster_copier/_instances_0/s0_1_0/logs/copier/clickhouse-copier_20230206220846_368/log.log:2023.02.06 22:09:19.015251 [ 368 ] {} <Error> : virtual int DB::ClusterCopierApp::main(const std::vector<std::string> &): Code: 341. DB::Exception: Too many tries to process table cluster1.default.hits. Abort remaining execution. (UNFINISHED), Stack trace (when copying this message, always include the lines below):

And apparently that it is due to query error with fault injection:

    2023.02.06 22:09:15.654724 [ 368 ] {} <Error> Application: An error occurred while processing partition 0: Code: 62. DB::Exception: Syntax error (Query): failed at position 168 ('Native'): Native. Expected one of: token, Dot, OR, AND, BETWEEN, NOT BETWEEN, LIKE, ILIKE, NOT LIKE, NOT ILIKE, IN, NOT IN, GLOBAL IN, GLOBAL NOT IN, MOD, DIV, IS NULL, IS NOT NULL, alias, AS, Comma, OFFSET, WITH TIES, BY, LIMIT, SETTINGS, UNION, EXCEPT, INTERSECT, INTO OUTFILE, FORMAT, end of query. (SYNTAX_ERROR), Stack trace (when copying this message, always include the lines below):

Example:

    select x from x limit  1FORMAT Native

    Syntax error: failed at position 32 ('Native'):

So fixing this should fix test_cluster_copier flakiness.

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/46045/bd4170e03c6af583a51d12d2c39fa775dcb9997b/integration_tests__release__[4/4].html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-07 17:01:06 +01:00
..
Aliases.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
clickhouse-copier.cpp Remove dlopen 2022-09-17 03:02:34 +02:00
ClusterCopier.cpp Fix fault injection in copier (wrong query syntax) 2023-02-07 17:01:06 +01:00
ClusterCopier.h Separate TaskShard and TaskTable 2022-10-20 14:00:20 +00:00
ClusterCopierApp.cpp Make disks checks only for clickhouse-server 2022-11-20 16:28:35 +01:00
ClusterCopierApp.h
ClusterPartition.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
CMakeLists.txt Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
Internals.cpp Better formatting for exception messages (#45449) 2023-01-24 00:13:58 +03:00
Internals.h Better formatting for exception messages (#45449) 2023-01-24 00:13:58 +03:00
ShardPartition.cpp Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
ShardPartition.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
ShardPartitionPiece.cpp Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
ShardPartitionPiece.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
StatusAccumulator.cpp Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
StatusAccumulator.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
TaskCluster.cpp Better formatting for exception messages (#45449) 2023-01-24 00:13:58 +03:00
TaskCluster.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
TaskShard.cpp Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
TaskShard.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
TaskTable.cpp Better formatting for exception messages (#45449) 2023-01-24 00:13:58 +03:00
TaskTable.h Un-clusterf$ck incomplete type errors 2022-10-20 14:48:46 +00:00
ZooKeeperStaff.h Fixes for -Wshorten-64-to-32 2022-10-21 13:25:19 +02:00