From bd3f9e2a22966d6cf92b3b7c6895515e19662119 Mon Sep 17 00:00:00 2001 From: tavplubix Date: Wed, 11 Nov 2020 13:09:48 +0300 Subject: [PATCH 01/22] Fix strange code in InterpreterShowAccessQuery --- src/Interpreters/InterpreterShowAccessQuery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interpreters/InterpreterShowAccessQuery.cpp b/src/Interpreters/InterpreterShowAccessQuery.cpp index 5f28c49c0bc..ecac962878c 100644 --- a/src/Interpreters/InterpreterShowAccessQuery.cpp +++ b/src/Interpreters/InterpreterShowAccessQuery.cpp @@ -78,7 +78,7 @@ ASTs InterpreterShowAccessQuery::getCreateAndGrantQueries() const for (const auto & entity : entities) { create_queries.push_back(InterpreterShowCreateAccessEntityQuery::getCreateQuery(*entity, access_control)); - if (entity->isTypeOf(EntityType::USER) || entity->isTypeOf(EntityType::USER)) + if (entity->isTypeOf(EntityType::USER) || entity->isTypeOf(EntityType::ROLE)) boost::range::push_back(grant_queries, InterpreterShowGrantsQuery::getGrantQueries(*entity, access_control)); } From 4a77a42f348594b485b8a1b33b9e4f8c85e19565 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 10 Nov 2020 00:27:25 +0300 Subject: [PATCH 02/22] Test for Merge(Distributed()) with JOIN --- .../01560_merge_distributed_join.reference | 0 .../0_stateless/01560_merge_distributed_join.sql | 14 ++++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/queries/0_stateless/01560_merge_distributed_join.reference create mode 100644 tests/queries/0_stateless/01560_merge_distributed_join.sql diff --git a/tests/queries/0_stateless/01560_merge_distributed_join.reference b/tests/queries/0_stateless/01560_merge_distributed_join.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/01560_merge_distributed_join.sql b/tests/queries/0_stateless/01560_merge_distributed_join.sql new file mode 100644 index 00000000000..5f0a8b0f99c --- /dev/null +++ b/tests/queries/0_stateless/01560_merge_distributed_join.sql @@ -0,0 +1,14 @@ +-- test from https://github.com/ClickHouse/ClickHouse/issues/11755#issuecomment-700850254 +DROP TABLE IF EXISTS cat_hist; +DROP TABLE IF EXISTS prod_hist; +DROP TABLE IF EXISTS products_l; +DROP TABLE IF EXISTS products; + +CREATE TABLE cat_hist (categoryId UUID, categoryName String) ENGINE Memory; +CREATE TABLE prod_hist (categoryId UUID, productId UUID) ENGINE = MergeTree ORDER BY productId; + +CREATE TABLE products_l AS prod_hist ENGINE = Distributed(test_cluster_two_shards, currentDatabase(), prod_hist); +CREATE TABLE products as prod_hist ENGINE = Merge(currentDatabase(), '^products_'); + +SELECT * FROM products AS p LEFT JOIN cat_hist AS c USING (categoryId); +SELECT * FROM products AS p GLOBAL LEFT JOIN cat_hist AS c USING (categoryId); From 52974170503b2d2109f3f04509ad2dceb1d668b0 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 14 Nov 2020 01:56:25 +0300 Subject: [PATCH 03/22] Fix Merge(Distributed()) with JOIN --- src/Storages/StorageMerge.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Storages/StorageMerge.cpp b/src/Storages/StorageMerge.cpp index 3e6f99878a6..d569007637d 100644 --- a/src/Storages/StorageMerge.cpp +++ b/src/Storages/StorageMerge.cpp @@ -134,6 +134,18 @@ bool StorageMerge::mayBenefitFromIndexForIn(const ASTPtr & left_in_operand, cons QueryProcessingStage::Enum StorageMerge::getQueryProcessingStage(const Context & context, QueryProcessingStage::Enum to_stage, SelectQueryInfo & query_info) const { + ASTPtr modified_query = query_info.query->clone(); + auto & modified_select = modified_query->as(); + /// In case of JOIN the first stage (which includes JOIN) + /// should be done on the initiator always. + /// + /// Since in case of JOIN query on shards will receive query w/o JOIN (and their columns). + /// (see modifySelect()/removeJoin()) + /// + /// And for this we need to return FetchColumns. + if (removeJoin(modified_select)) + return QueryProcessingStage::FetchColumns; + auto stage_in_source_tables = QueryProcessingStage::FetchColumns; DatabaseTablesIteratorPtr iterator = getDatabaseIterator(context); From 9cbb251be628aec800bd39b1dca8c93fc9b1056e Mon Sep 17 00:00:00 2001 From: Pavel Kovalenko Date: Fri, 20 Nov 2020 14:08:43 +0300 Subject: [PATCH 04/22] Store read-only flag into metadata file for DiskS3. --- src/Disks/S3/DiskS3.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Disks/S3/DiskS3.cpp b/src/Disks/S3/DiskS3.cpp index 2705040841c..3c75a8980ac 100644 --- a/src/Disks/S3/DiskS3.cpp +++ b/src/Disks/S3/DiskS3.cpp @@ -34,6 +34,7 @@ namespace ErrorCodes extern const int UNKNOWN_FORMAT; extern const int INCORRECT_DISK_INDEX; extern const int NOT_IMPLEMENTED; + extern const int PATH_ACCESS_DENIED; } @@ -93,6 +94,7 @@ namespace /// Metadata file version. static constexpr UInt32 VERSION_ABSOLUTE_PATHS = 1; static constexpr UInt32 VERSION_RELATIVE_PATHS = 2; + static constexpr UInt32 VERSION_READ_ONLY_FLAG = 3; using PathAndSize = std::pair; @@ -109,6 +111,8 @@ namespace std::vector s3_objects; /// Number of references (hardlinks) to this metadata file. UInt32 ref_count; + /// Flag indicates that file is read only. + bool read_only; /// Load metadata by path or create empty if `create` flag is set. explicit Metadata(const String & s3_root_path_, const String & disk_path_, const String & metadata_file_path_, bool create = false) @@ -122,10 +126,10 @@ namespace UInt32 version; readIntText(version, buf); - if (version != VERSION_RELATIVE_PATHS && version != VERSION_ABSOLUTE_PATHS) + if (version < VERSION_ABSOLUTE_PATHS || version > VERSION_READ_ONLY_FLAG) throw Exception( "Unknown metadata file version. Path: " + disk_path + metadata_file_path - + " Version: " + std::to_string(version) + ", Maximum expected version: " + std::to_string(VERSION_RELATIVE_PATHS), + + " Version: " + std::to_string(version) + ", Maximum expected version: " + std::to_string(VERSION_READ_ONLY_FLAG), ErrorCodes::UNKNOWN_FORMAT); assertChar('\n', buf); @@ -158,6 +162,12 @@ namespace readIntText(ref_count, buf); assertChar('\n', buf); + + if (version >= VERSION_READ_ONLY_FLAG) + { + readBoolText(read_only, buf); + assertChar('\n', buf); + } } void addObject(const String & path, size_t size) @@ -189,6 +199,9 @@ namespace writeIntText(ref_count, buf); writeChar('\n', buf); + writeBoolText(read_only, buf); + writeChar('\n', buf); + buf.finalize(); if (sync) buf.sync(); @@ -632,6 +645,12 @@ std::unique_ptr DiskS3::readFile(const String & path, si std::unique_ptr DiskS3::writeFile(const String & path, size_t buf_size, WriteMode mode, size_t estimated_size, size_t) { bool exist = exists(path); + if (exist) + { + Metadata metadata(s3_root_path, metadata_path, path); + if (metadata.read_only) + throw Exception("File is read-only: " + path, ErrorCodes::PATH_ACCESS_DENIED); + } /// Path to store new S3 object. auto s3_path = getRandomName(); bool is_multipart = estimated_size >= min_multi_part_upload_size; @@ -797,7 +816,11 @@ void DiskS3::createFile(const String & path) void DiskS3::setReadOnly(const String & path) { - Poco::File(metadata_path + path).setReadOnly(true); + /// We should store read only flag inside metadata file (instead of using FS flag), + /// because we modify metadata file when create hard-links from it. + Metadata metadata(s3_root_path, metadata_path, path); + metadata.read_only = true; + metadata.save(); } int DiskS3::open(const String & /*path*/, mode_t /*mode*/) const From 6b2fa22000a7be9fed448a96d63dafeccf104212 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Thu, 5 Nov 2020 23:54:31 +0800 Subject: [PATCH 05/22] ISSUES-16605 try fix MySQL handler affected rows when insert select query --- src/Server/MySQLHandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Server/MySQLHandler.cpp b/src/Server/MySQLHandler.cpp index c88b9016e84..076a5d72125 100644 --- a/src/Server/MySQLHandler.cpp +++ b/src/Server/MySQLHandler.cpp @@ -328,6 +328,9 @@ void MySQLHandler::comQuery(ReadBuffer & payload) Context query_context = connection_context; + size_t affected_rows = 0; + query_context.setProgressCallback([&](const Progress & progress) { affected_rows += progress.written_rows; }); + executeQuery(should_replace ? replacement : payload, *out, true, query_context, [&with_output](const String &, const String &, const String &, const String &) { @@ -336,7 +339,7 @@ void MySQLHandler::comQuery(ReadBuffer & payload) ); if (!with_output) - packet_endpoint->sendPacket(OKPacket(0x00, client_capability_flags, 0, 0, 0), true); + packet_endpoint->sendPacket(OKPacket(0x00, client_capability_flags, affected_rows, 0, 0), true); } } From a6dbba59324d79d6e50ca635b935c3f52858a6e3 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Fri, 6 Nov 2020 00:10:27 +0800 Subject: [PATCH 06/22] ISSUES-16605 add integration test --- tests/integration/test_mysql_protocol/test.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/integration/test_mysql_protocol/test.py b/tests/integration/test_mysql_protocol/test.py index 04cbef59af7..a8df0db05b7 100644 --- a/tests/integration/test_mysql_protocol/test.py +++ b/tests/integration/test_mysql_protocol/test.py @@ -154,6 +154,36 @@ def test_mysql_client_exception(mysql_client, server_address): "ERROR 1000 (00000) at line 1: Poco::Exception. Code: 1000, e.code() = 2002, e.displayText() = mysqlxx::ConnectionFailed: Can't connect to MySQL server on '127.0.0.1' (115) ((nullptr):0)" +def test_mysql_affected_rows(mysql_client, server_address): + code, (stdout, stderr) = mysql_client.exec_run(''' + mysql --protocol tcp -h {host} -P {port} default -u default --password=123 + -e "CREATE TABLE IF NOT EXISTS default.t1 (n UInt64) ENGINE MergeTree() ORDER BY tuple();" + '''.format(host=server_address, port=server_port), demux=True) + assert code == 0 + + code, (stdout, stderr) = mysql_client.exec_run(''' + mysql -vvv --protocol tcp -h {host} -P {port} default -u default --password=123 + -e "INSERT INTO default.t1(n) VALUES(1);" + '''.format(host=server_address, port=server_port), demux=True) + + assert code == 0 + assert "1 rows affected" in stdout + + code, (stdout, stderr) = mysql_client.exec_run(''' + mysql -vvv --protocol tcp -h {host} -P {port} default -u default --password=123 + -e "INSERT INTO default.t1(n) SELECT * FROM numbers(1000)" + '''.format(host=server_address, port=server_port), demux=True) + + assert code == 0 + assert "1000 rows affected" in stdout + + code, (stdout, stderr) = mysql_client.exec_run(''' + mysql --protocol tcp -h {host} -P {port} default -u default --password=123 + -e "DROP TABLE default.t1;" + '''.format(host=server_address, port=server_port), demux=True) + assert code == 0 + + def test_mysql_replacement_query(mysql_client, server_address): # SHOW TABLE STATUS LIKE. code, (stdout, stderr) = mysql_client.exec_run(''' From 5b3154b2988d735d321c975646853180edf70f48 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Fri, 6 Nov 2020 09:54:33 +0800 Subject: [PATCH 07/22] ISSUES-16605 try fix integration test failure --- tests/integration/test_mysql_protocol/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_mysql_protocol/test.py b/tests/integration/test_mysql_protocol/test.py index a8df0db05b7..8b4be51191f 100644 --- a/tests/integration/test_mysql_protocol/test.py +++ b/tests/integration/test_mysql_protocol/test.py @@ -167,7 +167,7 @@ def test_mysql_affected_rows(mysql_client, server_address): '''.format(host=server_address, port=server_port), demux=True) assert code == 0 - assert "1 rows affected" in stdout + assert "1 rows affected" in stdout.decode() code, (stdout, stderr) = mysql_client.exec_run(''' mysql -vvv --protocol tcp -h {host} -P {port} default -u default --password=123 @@ -175,7 +175,7 @@ def test_mysql_affected_rows(mysql_client, server_address): '''.format(host=server_address, port=server_port), demux=True) assert code == 0 - assert "1000 rows affected" in stdout + assert "1000 rows affected" in stdout.decode() code, (stdout, stderr) = mysql_client.exec_run(''' mysql --protocol tcp -h {host} -P {port} default -u default --password=123 From e1e5eede869d281d96b3046b43315d6660728807 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Fri, 6 Nov 2020 18:28:37 +0800 Subject: [PATCH 08/22] ISSUES-16605 try fix integration failure --- tests/integration/test_mysql_protocol/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_mysql_protocol/test.py b/tests/integration/test_mysql_protocol/test.py index 8b4be51191f..e2f787f9ee3 100644 --- a/tests/integration/test_mysql_protocol/test.py +++ b/tests/integration/test_mysql_protocol/test.py @@ -167,7 +167,7 @@ def test_mysql_affected_rows(mysql_client, server_address): '''.format(host=server_address, port=server_port), demux=True) assert code == 0 - assert "1 rows affected" in stdout.decode() + assert "1 row affected" in stdout.decode() code, (stdout, stderr) = mysql_client.exec_run(''' mysql -vvv --protocol tcp -h {host} -P {port} default -u default --password=123 From 0985029f49e2614b548990ae261a67297c902df8 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Wed, 11 Nov 2020 20:46:43 +0800 Subject: [PATCH 09/22] trigger CI From ade04b5dc462b807a9d1496c213ef6cb404b7049 Mon Sep 17 00:00:00 2001 From: zhang2014 Date: Sun, 22 Nov 2020 20:42:55 +0800 Subject: [PATCH 10/22] ISSUES-16605 try fix review comment --- src/Server/MySQLHandler.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Server/MySQLHandler.cpp b/src/Server/MySQLHandler.cpp index 076a5d72125..957930ad43b 100644 --- a/src/Server/MySQLHandler.cpp +++ b/src/Server/MySQLHandler.cpp @@ -328,8 +328,15 @@ void MySQLHandler::comQuery(ReadBuffer & payload) Context query_context = connection_context; - size_t affected_rows = 0; - query_context.setProgressCallback([&](const Progress & progress) { affected_rows += progress.written_rows; }); + std::atomic affected_rows {0}; + auto prev = query_context.getProgressCallback(); + query_context.setProgressCallback([&, prev = prev](const Progress & progress) + { + if (prev) + prev(progress); + + affected_rows += progress.written_rows; + }); executeQuery(should_replace ? replacement : payload, *out, true, query_context, [&with_output](const String &, const String &, const String &, const String &) From f6041c22804d82c0366bbb45e85e33176f419bda Mon Sep 17 00:00:00 2001 From: Pavel Kovalenko Date: Mon, 23 Nov 2020 00:14:52 +0300 Subject: [PATCH 11/22] Use default value for read-only flag in metadata for Disk3. --- src/Disks/S3/DiskS3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disks/S3/DiskS3.cpp b/src/Disks/S3/DiskS3.cpp index 3c75a8980ac..507af58f9fa 100644 --- a/src/Disks/S3/DiskS3.cpp +++ b/src/Disks/S3/DiskS3.cpp @@ -112,7 +112,7 @@ namespace /// Number of references (hardlinks) to this metadata file. UInt32 ref_count; /// Flag indicates that file is read only. - bool read_only; + bool read_only = false; /// Load metadata by path or create empty if `create` flag is set. explicit Metadata(const String & s3_root_path_, const String & disk_path_, const String & metadata_file_path_, bool create = false) From 2c982b4ccf71823b82a3924234a4687543234b75 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 23 Nov 2020 09:35:08 +0300 Subject: [PATCH 12/22] Fix race condition; history and sharing capabilities --- programs/server/play.html | 92 ++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/programs/server/play.html b/programs/server/play.html index 22eea0002ca..eabeb6b71ad 100644 --- a/programs/server/play.html +++ b/programs/server/play.html @@ -30,17 +30,6 @@ It can be done in background, e.g. wait 100 ms after address/credentials change and do the check. Also it can provide visual indication that credentials are correct. - 3. Add history in localstorage. Integrate with history API. - There can be a counter in localstorage, that will be appended to location #fragment. - The 'back', 'forward' buttons in browser should work. - Also there should be UI element to list all the queries from history and select from the list. - - 4. Trivial sharing capabilities. - Sharing is only possible when system.query_log is accessible. Read the X-ClickHouse-QueryId from the response. - Share button will: - emit SYSTEM FLUSH LOGS if not readonly; - find the query in the query_log; - - generate an URL with the query id and: server address if not equal to the URL's host; user name if not default; - indication that password should be entered in case of non-empty password. - --> @@ -275,6 +292,8 @@
 (Ctrl+Enter) + + 🌑🌞
@@ -319,6 +338,9 @@ xhr.open('POST', url, true); xhr.send(query); + document.getElementById('check-mark').style.display = 'none'; + document.getElementById('hourglass').style.display = 'inline'; + xhr.onreadystatechange = function() { if (posted_request_num != request_num) { @@ -348,6 +370,8 @@ } function renderResponse(status, response) { + document.getElementById('hourglass').style.display = 'none'; + if (status === 200) { var json; try { json = JSON.parse(response); } catch (e) {} @@ -356,6 +380,7 @@ } else { renderUnparsedResult(response); } + document.getElementById('check-mark').style.display = 'inline'; } else { /// TODO: Proper rendering of network errors. renderError(response); @@ -390,7 +415,7 @@ post(); } - document.getElementById('query').onkeypress = function(event) + document.onkeypress = function(event) { /// Firefox has code 13 for Enter and Chromium has code 10. if (event.ctrlKey && (event.charCode == 13 || event.charCode == 10)) { @@ -412,6 +437,9 @@ document.getElementById('error').style.display = 'none'; document.getElementById('stats').innerText = ''; + + document.getElementById('hourglass').style.display = 'none'; + document.getElementById('check-mark').style.display = 'none'; } function renderResult(response) From f3e567b4b4d6602949e1969c8c65eb25a5e90c7f Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 23 Nov 2020 10:15:52 +0300 Subject: [PATCH 14/22] Update roadmap --- programs/server/play.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/programs/server/play.html b/programs/server/play.html index f7f9190884c..d78a60ff83b 100644 --- a/programs/server/play.html +++ b/programs/server/play.html @@ -22,11 +22,7 @@ From a543c8e468c2876dd4826bbc5d87595c8b0129aa Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov Date: Mon, 23 Nov 2020 21:04:53 +0300 Subject: [PATCH 21/22] Add an option to use existing tables to perf.py --- docker/test/performance-comparison/perf.py | 93 ++++++++++++---------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/docker/test/performance-comparison/perf.py b/docker/test/performance-comparison/perf.py index 2568f7ac066..1c54479aab3 100755 --- a/docker/test/performance-comparison/perf.py +++ b/docker/test/performance-comparison/perf.py @@ -48,6 +48,8 @@ parser.add_argument('--profile-seconds', type=int, default=0, help='For how many parser.add_argument('--long', action='store_true', help='Do not skip the tests tagged as long.') parser.add_argument('--print-queries', action='store_true', help='Print test queries and exit.') parser.add_argument('--print-settings', action='store_true', help='Print test settings and exit.') +parser.add_argument('--keep-created-tables', action='store_true', help="Don't drop the created tables after the test.") +parser.add_argument('--use-existing-tables', action='store_true', help="Don't create or drop the tables, use the existing ones instead.") args = parser.parse_args() reportStageEnd('start') @@ -148,20 +150,21 @@ for i, s in enumerate(servers): reportStageEnd('connect') -# Run drop queries, ignoring errors. Do this before all other activity, because -# clickhouse_driver disconnects on error (this is not configurable), and the new -# connection loses the changes in settings. -drop_query_templates = [q.text for q in root.findall('drop_query')] -drop_queries = substitute_parameters(drop_query_templates) -for conn_index, c in enumerate(all_connections): - for q in drop_queries: - try: - c.execute(q) - print(f'drop\t{conn_index}\t{c.last_query.elapsed}\t{tsv_escape(q)}') - except: - pass +if not args.use_existing_tables: + # Run drop queries, ignoring errors. Do this before all other activity, + # because clickhouse_driver disconnects on error (this is not configurable), + # and the new connection loses the changes in settings. + drop_query_templates = [q.text for q in root.findall('drop_query')] + drop_queries = substitute_parameters(drop_query_templates) + for conn_index, c in enumerate(all_connections): + for q in drop_queries: + try: + c.execute(q) + print(f'drop\t{conn_index}\t{c.last_query.elapsed}\t{tsv_escape(q)}') + except: + pass -reportStageEnd('drop-1') + reportStageEnd('drop-1') # Apply settings. # If there are errors, report them and continue -- maybe a new test uses a setting @@ -193,37 +196,40 @@ for t in tables: reportStageEnd('preconditions') -# Run create and fill queries. We will run them simultaneously for both servers, -# to save time. -# The weird search is to keep the relative order of elements, which matters, and -# etree doesn't support the appropriate xpath query. -create_query_templates = [q.text for q in root.findall('./*') if q.tag in ('create_query', 'fill_query')] -create_queries = substitute_parameters(create_query_templates) +if not args.use_existing_tables: + # Run create and fill queries. We will run them simultaneously for both + # servers, to save time. The weird XML search + filter is because we want to + # keep the relative order of elements, and etree doesn't support the + # appropriate xpath query. + create_query_templates = [q.text for q in root.findall('./*') + if q.tag in ('create_query', 'fill_query')] + create_queries = substitute_parameters(create_query_templates) -# Disallow temporary tables, because the clickhouse_driver reconnects on errors, -# and temporary tables are destroyed. We want to be able to continue after some -# errors. -for q in create_queries: - if re.search('create temporary table', q, flags=re.IGNORECASE): - print(f"Temporary tables are not allowed in performance tests: '{q}'", - file = sys.stderr) - sys.exit(1) + # Disallow temporary tables, because the clickhouse_driver reconnects on + # errors, and temporary tables are destroyed. We want to be able to continue + # after some errors. + for q in create_queries: + if re.search('create temporary table', q, flags=re.IGNORECASE): + print(f"Temporary tables are not allowed in performance tests: '{q}'", + file = sys.stderr) + sys.exit(1) -def do_create(connection, index, queries): - for q in queries: - connection.execute(q) - print(f'create\t{index}\t{connection.last_query.elapsed}\t{tsv_escape(q)}') + def do_create(connection, index, queries): + for q in queries: + connection.execute(q) + print(f'create\t{index}\t{connection.last_query.elapsed}\t{tsv_escape(q)}') -threads = [Thread(target = do_create, args = (connection, index, create_queries)) - for index, connection in enumerate(all_connections)] + threads = [ + Thread(target = do_create, args = (connection, index, create_queries)) + for index, connection in enumerate(all_connections)] -for t in threads: - t.start() + for t in threads: + t.start() -for t in threads: - t.join() + for t in threads: + t.join() -reportStageEnd('create') + reportStageEnd('create') # By default, test all queries. queries_to_run = range(0, len(test_queries)) @@ -402,10 +408,11 @@ print(f'profile-total\t{profile_total_seconds}') reportStageEnd('run') # Run drop queries -drop_queries = substitute_parameters(drop_query_templates) -for conn_index, c in enumerate(all_connections): - for q in drop_queries: - c.execute(q) - print(f'drop\t{conn_index}\t{c.last_query.elapsed}\t{tsv_escape(q)}') +if not args.keep_created_tables and not args.use_existing_tables: + drop_queries = substitute_parameters(drop_query_templates) + for conn_index, c in enumerate(all_connections): + for q in drop_queries: + c.execute(q) + print(f'drop\t{conn_index}\t{c.last_query.elapsed}\t{tsv_escape(q)}') reportStageEnd('drop-2') From 3ab9ac03dfc5c26b930ed8a1425f555039e3ff1b Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 23 Nov 2020 21:51:38 +0300 Subject: [PATCH 22/22] Update documentation-issue.md --- .github/ISSUE_TEMPLATE/documentation-issue.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/documentation-issue.md b/.github/ISSUE_TEMPLATE/documentation-issue.md index a8f31eadc56..557e5ea43c9 100644 --- a/.github/ISSUE_TEMPLATE/documentation-issue.md +++ b/.github/ISSUE_TEMPLATE/documentation-issue.md @@ -2,8 +2,7 @@ name: Documentation issue about: Report something incorrect or missing in documentation title: '' -labels: documentation -assignees: BayoNet +labels: comp-documentation ---