Pass settings for perf tests via protocol over SET query

Thus they will be applied on reconnects, since clickhouse-driver may
implicitly do it if the connection has been failed.
This commit is contained in:
Azat Khuzhin 2020-11-21 13:51:34 +03:00
parent 3ddb0ac53e
commit d676e2f5c5

View File

@ -173,12 +173,9 @@ reportStageEnd('drop-1')
settings = root.findall('settings/*')
for conn_index, c in enumerate(all_connections):
for s in settings:
try:
q = f"set {s.tag} = '{s.text}'"
c.execute(q)
print(f'set\t{conn_index}\t{c.last_query.elapsed}\t{tsv_escape(q)}')
except:
print(traceback.format_exc(), file=sys.stderr)
# requires clickhouse-driver >= 1.1.5 to accept arbitrary new settings
# (https://github.com/mymarilyn/clickhouse-driver/pull/142)
c.settings[s.tag] = s.text
reportStageEnd('settings')