Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYSTEM FLUSH LOGS ON CLUSTER does not throw SYNTAX_ERROR #44264

Closed
qoega opened this issue Dec 15, 2022 · 3 comments · Fixed by #44387
Closed

SYSTEM FLUSH LOGS ON CLUSTER does not throw SYNTAX_ERROR #44264

qoega opened this issue Dec 15, 2022 · 3 comments · Fixed by #44387
Assignees

Comments

@qoega
Copy link
Member

qoega commented Dec 15, 2022

Describe the unexpected behaviour
If ON CLUSTER is unsupported it should return error.
I would expect logs to be flushed on all replicas.
If it is running asynchronously, wee need synchronous version.

How to reproduce

  1. Have several replicas in cluster like in ClickHouse Cloud. Use separate connections but running one query at a time.
  2. SELECT 1 to node1
  3. SYSTEM FLUSH LOGS ON CLUSTER to node2
  4. SELECT * from system.query_log from node 1

Expected behavior
Query log on node1 should be flushed.

@tavplubix
Copy link
Member

tavplubix commented Dec 15, 2022

SYSTEM FLUSH LOGS ON CLUSTER is applied on all hosts, most likely you made a mistake when checking this (I cannot reproduce it with the provided steps).

@qoega
Copy link
Member Author

qoega commented Dec 19, 2022

#! /bin/bash
set -x 
export ENDPOINT=
export PASSWORD=
for NUMBER in {1..1000} 
do
    export ID="rep_${NUMBER}"
    ~/clickhouse client --host $ENDPOINT --user default --password $PASSWORD --secure --database smoke --query "SELECT * FROM numbers(10000) FORMAT Null" --query_id ${ID}
    ~/clickhouse client --host $ENDPOINT --user default --password $PASSWORD --secure --database smoke --query "SYSTEM FLUSH LOGS ON CLUSTER"
    for RUN in {1..10}
    do
        RES=$(~/clickhouse client --host $ENDPOINT --user default --password $PASSWORD --secure --database smoke --query "select count()  from clusterAllReplicas(default, system.query_log) where event_date=today() and type='QueryFinish' and query_id='${ID}'")
        echo $ID " " $RES
        if (( $RES > 0 ))
        then
            break;
        else if (( $RES == 0 ))
            then
            echo "REPRODUCED";
            exit
            fi
        fi
    done
done
+ for NUMBER in {1..1000}
+ export ID=rep_1
+ ID=rep_1
+ /home/ubuntu/clickhouse client --host ... --user default --password ... --secure --database smoke --query 'SELECT * FROM numbers(10000) FORMAT Null' --query_id rep_1
+ /home/ubuntu/clickhouse client --host ... --user default --password ... --secure --database smoke --query 'SYSTEM FLUSH LOGS ON CLUSTER'
+ for RUN in {1..10}
++ /home/ubuntu/clickhouse client --host ... --user default --password ... --secure --database smoke --query 'select count()  from clusterAllReplicas(default, system.query_log) where event_date=today() and type='\''QueryFinish'\'' and query_id='\''rep_1'\'''
+ RES=1
+ echo rep_1 ' ' 1
rep_1   1
+ ((  1 > 0  ))
+ break
+ for NUMBER in {1..1000}
+ export ID=rep_2
+ ID=rep_2
+ /home/ubuntu/clickhouse client --host ... --user default --password ... --secure --database smoke --query 'SELECT * FROM numbers(10000) FORMAT Null' --query_id rep_2
+ /home/ubuntu/clickhouse client --host ... --user default --password ... --secure --database smoke --query 'SYSTEM FLUSH LOGS ON CLUSTER'
+ for RUN in {1..10}
++ /home/ubuntu/clickhouse client --host ... --user default --password ... --secure --database smoke --query 'select count()  from clusterAllReplicas(default, system.query_log) where event_date=today() and type='\''QueryFinish'\'' and query_id='\''rep_2'\'''
+ RES=0
+ echo rep_2 ' ' 0
rep_2   0
+ ((  0 > 0  ))
+ ((  0 == 0  ))
+ echo REPRODUCED
REPRODUCED
+ exit

@qoega qoega reopened this Dec 19, 2022
@tavplubix tavplubix changed the title SYSTEM FLUSH LOGS ON CLUSTER works but applies to initiator node only SYSTEM FLUSH LOGS ON CLUSTER does not throw SYNTAX_ERROR Dec 19, 2022
@tavplubix
Copy link
Member

A cluster name is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants