Merge branch 'master' into refactoring

This commit is contained in:
chertus 2018-09-07 17:39:22 +03:00
commit d7bb629195
12 changed files with 41 additions and 25 deletions

View File

@ -8,7 +8,12 @@
# sudo apt-get install ninja-build # sudo apt-get install ninja-build
# CLion does not support Ninja # CLion does not support Ninja
if (NOT ${CMAKE_COMMAND} MATCHES "clion") # You can add your vote on CLion task tracker:
# https://youtrack.jetbrains.com/issue/CPP-2659
# https://youtrack.jetbrains.com/issue/CPP-870
string(TOLOWER "${CMAKE_COMMAND}" CMAKE_COMMAND_LOWER)
if (NOT ${CMAKE_COMMAND_LOWER} MATCHES "clion")
find_program(NINJA_PATH ninja) find_program(NINJA_PATH ninja)
if (NINJA_PATH) if (NINJA_PATH)
set(CMAKE_GENERATOR "Ninja" CACHE INTERNAL "" FORCE) set(CMAKE_GENERATOR "Ninja" CACHE INTERNAL "" FORCE)

View File

@ -76,6 +76,12 @@ class ClickHouseCluster:
self.is_up = False self.is_up = False
def get_client_cmd(self):
cmd = self.client_bin_path
if p.basename(cmd) == 'clickhouse':
cmd += " client"
return cmd
def add_instance(self, name, config_dir=None, main_configs=[], user_configs=[], macros={}, with_zookeeper=False, with_mysql=False, with_kafka=False, clickhouse_path_dir=None, with_odbc_drivers=False, hostname=None, env_variables={}, image="ubuntu:14.04"): def add_instance(self, name, config_dir=None, main_configs=[], user_configs=[], macros={}, with_zookeeper=False, with_mysql=False, with_kafka=False, clickhouse_path_dir=None, with_odbc_drivers=False, hostname=None, env_variables={}, image="ubuntu:14.04"):
"""Add an instance to the cluster. """Add an instance to the cluster.

View File

@ -67,20 +67,20 @@ def test_deduplication_works_in_case_of_intensive_inserts(started_cluster):
inserters.append(CommandRequest(['/bin/bash'], timeout=10, stdin=""" inserters.append(CommandRequest(['/bin/bash'], timeout=10, stdin="""
set -e set -e
for i in `seq 1000`; do for i in `seq 1000`; do
clickhouse-client --host {} -q "INSERT INTO simple VALUES (0, 0)" {} --host {} -q "INSERT INTO simple VALUES (0, 0)"
done done
""".format(host))) """.format(cluster.get_client_cmd(), host)))
fetchers.append(CommandRequest(['/bin/bash'], timeout=10, stdin=""" fetchers.append(CommandRequest(['/bin/bash'], timeout=10, stdin="""
set -e set -e
for i in `seq 1000`; do for i in `seq 1000`; do
res=`clickhouse-client --host {} -q "SELECT count() FROM simple"` res=`{} --host {} -q "SELECT count() FROM simple"`
if [[ $? -ne 0 || $res -ne 1 ]]; then if [[ $? -ne 0 || $res -ne 1 ]]; then
echo "Selected $res elements! Host: {}" 1>&2 echo "Selected $res elements! Host: {}" 1>&2
exit -1 exit -1
fi; fi;
done done
""".format(host, node.name))) """.format(cluster.get_client_cmd(), host, node.name)))
# There were not errors during INSERTs # There were not errors during INSERTs
for inserter in inserters: for inserter in inserters:

View File

@ -50,7 +50,7 @@ def test_random_inserts(started_cluster):
bash_script = os.path.join(os.path.dirname(__file__), "test.sh") bash_script = os.path.join(os.path.dirname(__file__), "test.sh")
inserters = [] inserters = []
for node in nodes: for node in nodes:
cmd = ['/bin/bash', bash_script, node.ip_address, str(min_timestamp), str(max_timestamp)] cmd = ['/bin/bash', bash_script, node.ip_address, str(min_timestamp), str(max_timestamp), str(cluster.get_client_cmd())]
inserters.append(CommandRequest(cmd, timeout=DURATION_SECONDS * 2, stdin='')) inserters.append(CommandRequest(cmd, timeout=DURATION_SECONDS * 2, stdin=''))
print node.name, node.ip_address print node.name, node.ip_address
@ -60,7 +60,7 @@ def test_random_inserts(started_cluster):
answer="{}\t{}\t{}\t{}\n".format(num_timestamps, num_timestamps, min_timestamp, max_timestamp) answer="{}\t{}\t{}\t{}\n".format(num_timestamps, num_timestamps, min_timestamp, max_timestamp)
for node in nodes: for node in nodes:
res = node.query("SELECT count(), uniqExact(i), min(i), max(i) FROM simple") res = node.query_with_retry("SELECT count(), uniqExact(i), min(i), max(i) FROM simple", check_callback=lambda res: TSV(res) == TSV(answer))
assert TSV(res) == TSV(answer), node.name + " : " + node.query("SELECT groupArray(_part), i, count() AS c FROM simple GROUP BY i ORDER BY c DESC LIMIT 1") assert TSV(res) == TSV(answer), node.name + " : " + node.query("SELECT groupArray(_part), i, count() AS c FROM simple GROUP BY i ORDER BY c DESC LIMIT 1")
node1.query("""DROP TABLE simple ON CLUSTER test_cluster""") node1.query("""DROP TABLE simple ON CLUSTER test_cluster""")

View File

@ -4,7 +4,7 @@
[[ -n "$1" ]] && host="$1" || host="localhost" [[ -n "$1" ]] && host="$1" || host="localhost"
[[ -n "$2" ]] && min_timestamp="$2" || min_timestamp=$(( $(date +%s) - 60 )) [[ -n "$2" ]] && min_timestamp="$2" || min_timestamp=$(( $(date +%s) - 60 ))
[[ -n "$3" ]] && max_timestamp="$3" || max_timestamp=$(( $(date +%s) + 60 )) [[ -n "$3" ]] && max_timestamp="$3" || max_timestamp=$(( $(date +%s) + 60 ))
[[ -n "$4" ]] && iters_per_timestamp="$4" || iters_per_timestamp=5 [[ -n "$4" ]] && client="$4" || client="clickhouse-client"
timestamps=`seq $min_timestamp $max_timestamp` timestamps=`seq $min_timestamp $max_timestamp`
@ -18,7 +18,7 @@ function reliable_insert {
fi fi
#echo clickhouse-client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')" #echo clickhouse-client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')"
res=`clickhouse-client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')" 2>&1` res=`$client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')" 2>&1`
rt=$? rt=$?
num_tries=$(($num_tries+1)) num_tries=$(($num_tries+1))

View File

@ -130,7 +130,7 @@ class Runner:
def test_mutations(started_cluster): def test_mutations(started_cluster):
DURATION_SECONDS = 50 DURATION_SECONDS = 30
runner = Runner() runner = Runner()
@ -155,8 +155,8 @@ def test_mutations(started_cluster):
assert runner.total_mutations > 0 assert runner.total_mutations > 0
all_done = False all_done = False
for i in range(100): # wait for replication 50 seconds max for i in range(100): # wait for replication 80 seconds max
time.sleep(0.5) time.sleep(0.8)
def get_done_mutations(node): def get_done_mutations(node):
return int(node.query("SELECT sum(is_done) FROM system.mutations WHERE table = 'test_mutations'").rstrip()) return int(node.query("SELECT sum(is_done) FROM system.mutations WHERE table = 'test_mutations'").rstrip())

View File

@ -52,4 +52,4 @@ FROM t_null
└────────────┘ └────────────┘
2 rows in set. Elapsed: 0.144 sec. 2 rows in set. Elapsed: 0.144 sec.
`` ```

View File

@ -20,7 +20,7 @@ In a column-oriented DBMS, data is stored like this:
| Row: | #0 | #1 | #2 | #N | | Row: | #0 | #1 | #2 | #N |
| ----------- | ------------------- | ------------------- | ------------------- | ------------------- | | ----------- | ------------------- | ------------------- | ------------------- | ------------------- |
| WatchID: | 5385521489354350662 | 5385521490329509958 | 5385521489953706054 | ... | | WatchID: | 89354350662 | 90329509958 | 89953706054 | ... |
| JavaEnable: | 1 | 0 | 1 | ... | | JavaEnable: | 1 | 0 | 1 | ... |
| Title: | Investor Relations | Contact us | Mission | ... | | Title: | Investor Relations | Contact us | Mission | ... |
| GoodEvent: | 1 | 1 | 1 | ... | | GoodEvent: | 1 | 1 | 1 | ... |
@ -61,11 +61,11 @@ Column-oriented databases are better suited to OLAP scenarios: they are at least
**Row-oriented DBMS** **Row-oriented DBMS**
![Row-oriented ]( images/row_oriented.gif#) ![Row-oriented](images/row_oriented.gif#)
**Column-oriented DBMS** **Column-oriented DBMS**
![Column-oriented](images / column_oriented.gif#) ![Column-oriented](images/column_oriented.gif#)
See the difference? See the difference?

View File

@ -4,12 +4,12 @@ ClickHouse - столбцовая система управления базам
В обычной, "строковой" СУБД, данные хранятся в таком порядке: В обычной, "строковой" СУБД, данные хранятся в таком порядке:
| Строка | WatchID | JavaEnable | Title | GoodEvent | EventTime | | Строка | WatchID | JavaEnable | Title | GoodEvent | EventTime |
| ------ | ------------------- | ---------- | ------------------ | --------- | ------------------- | | ------ | ----------- | ---------- | ------------------ | --------- | ------------------- |
| #0 | 5385521489354350662 | 1 | Investor Relations | 1 | 2016-05-18 05:19:20 | | #0 | 89354350662 | 1 | Investor Relations | 1 | 2016-05-18 05:19:20 |
| #1 | 5385521490329509958 | 0 | Contact us | 1 | 2016-05-18 08:10:20 | | #1 | 90329509958 | 0 | Contact us | 1 | 2016-05-18 08:10:20 |
| #2 | 5385521489953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 | | #2 | 89953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 |
| #N | ... | ... | ... | ... | ... | | #N | ... | ... | ... | ... | ... |
То есть, значения, относящиеся к одной строке, физически хранятся рядом. То есть, значения, относящиеся к одной строке, физически хранятся рядом.
@ -20,7 +20,7 @@ ClickHouse - столбцовая система управления базам
| Строка: | #0 | #1 | #2 | #N | | Строка: | #0 | #1 | #2 | #N |
| ----------- | ------------------- | ------------------- | ------------------- | ------------------- | | ----------- | ------------------- | ------------------- | ------------------- | ------------------- |
| WatchID: | 5385521489354350662 | 5385521490329509958 | 5385521489953706054 | ... | | WatchID: | 89354350662 | 90329509958 | 89953706054 | ... |
| JavaEnable: | 1 | 0 | 1 | ... | | JavaEnable: | 1 | 0 | 1 | ... |
| Title: | Investor Relations | Contact us | Mission | ... | | Title: | Investor Relations | Contact us | Mission | ... |
| GoodEvent: | 1 | 1 | 1 | ... | | GoodEvent: | 1 | 1 | 1 | ... |

View File

@ -26,7 +26,7 @@ var paths = {
docstxt: ['docs/**/*.txt', 'docs/redirects.conf'], docstxt: ['docs/**/*.txt', 'docs/redirects.conf'],
docsjson: ['docs/**/*.json'], docsjson: ['docs/**/*.json'],
docsxml: ['docs/**/*.xml'], docsxml: ['docs/**/*.xml'],
docssitemap: ['sitemap.xml'], docssitemap: ['sitemap.xml', 'sitemap_static.xml'],
scripts: [ scripts: [
'**/*.js', '**/*.js',
'!gulpfile.js', '!gulpfile.js',

View File

@ -1,8 +1,10 @@
User-agent: * User-agent: *
Disallow: /docs/en/single/ Disallow: /docs/en/single/
Disallow: /docs/ru/single/ Disallow: /docs/ru/single/
Disallow: /docs/fa/single/
Disallow: /docs/en/search.html Disallow: /docs/en/search.html
Disallow: /docs/ru/search.html Disallow: /docs/ru/search.html
Disallow: /docs/fa/search.html
Disallow: /deprecated/reference_en.html Disallow: /deprecated/reference_en.html
Disallow: /deprecated/reference_ru.html Disallow: /deprecated/reference_ru.html
Allow: / Allow: /

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://clickhouse.yandex/docs/en/sitemap.xml</loc>
</sitemap>
<sitemap> <sitemap>
<loc>https://clickhouse.yandex/docs/ru/sitemap.xml</loc> <loc>https://clickhouse.yandex/docs/ru/sitemap.xml</loc>
</sitemap> </sitemap>
<sitemap> <sitemap>
<loc>https://clickhouse.yandex/docs/en/sitemap.xml</loc> <loc>https://clickhouse.yandex/docs/fa/sitemap.xml</loc>
</sitemap> </sitemap>
<sitemap> <sitemap>
<loc>https://clickhouse.yandex/docs/sitemap_static.xml</loc> <loc>https://clickhouse.yandex/docs/sitemap_static.xml</loc>