Skip to content

Commit

Permalink
Code format corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhummelAltinity committed Aug 24, 2021
1 parent 956d498 commit 6fe6a9e
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 43 deletions.
Expand Up @@ -27,7 +27,7 @@ By default, to properly data loading from MySQL8 source to dictionaries, please

You can change default behavior with create `/etc/mysql/conf.d/information_schema_cache.cnf`with following content:

```text
```ini
[mysqld]
information_schema_stats_expiry=0
```
Expand Down
Expand Up @@ -95,7 +95,7 @@ See [https://github.com/ClickHouse/ClickHouse/issues/12609](https://github.com/C

### confluent cloud

```text
```xml
<yandex>
<kafka>
<auto_offset_reset>smallest</auto_offset_reset>
Expand All @@ -118,7 +118,7 @@ See [https://github.com/ClickHouse/ClickHouse/issues/12609](https://github.com/C

Use kafkacat utility - it internally uses same library to access Kafla as clickhouse itself and allows easily to test different settings.

```text
```bash
kafkacat -b my_broker:9092 -C -o -10 -t my_topic \
-X security.protocol=SASL_SSL \
-X sasl.mechanisms=PLAIN \
Expand Down
Expand Up @@ -6,7 +6,7 @@ description: >
---
For very large topics when you need more parallelism (especially on the insert side) you may use several tables with the same pipeline (pre 20.9) or enable `kafka_thread_per_consumer` (after 20.9).

```text
```ini
kafka_num_consumers = N,
kafka_thread_per_consumer=1
```
Expand Down
8 changes: 4 additions & 4 deletions content/en/altinity-kb-queries-and-syntax/time-zones.md
Expand Up @@ -13,7 +13,7 @@ Important things to know:
5. clickhouse-client also by default tries to use server timezone (see also `--use_client_time_zone` flag)
6. If you want you can store the timezone name inside the data type, in that case, timestamp &lt;-&gt; human-readable time rules of that timezone will be applied.

```text
```sql
SELECT
timezone(),
toDateTime(now()) AS t,
Expand All @@ -38,7 +38,7 @@ Since version 20.4 clickhouse uses embedded tzdata (see [https://github.com/Clic

You get used tzdata version

```text
```sql
SELECT *
FROM system.build_options
WHERE name = 'TZDATA_VERSION'
Expand All @@ -52,7 +52,7 @@ Query id: 0a9883f0-dadf-4fb1-8b42-8fe93f561430

and list of available time zones

```text
```sql
SELECT *
FROM system.time_zones
WHERE time_zone LIKE '%Anta%'
Expand Down Expand Up @@ -81,7 +81,7 @@ Query id: 855453d7-eccd-44cb-9631-f63bb02a273c

### When the conversion using different rules happen

```text
```sql
SELECT timezone()

┌─timezone()─┐
Expand Down
6 changes: 3 additions & 3 deletions content/en/altinity-kb-schema-design/floats-vs-decimals.md
Expand Up @@ -10,7 +10,7 @@ In case you need accurate calculations you should use Decimal datatypes.

### Operations on floats are not associative

```text
```sql
select toFloat64(100000000000000000.1) + toFloat64(7.5) - toFloat64(100000000000000000.1) as res;
---
title: "0"
Expand Down Expand Up @@ -55,7 +55,7 @@ Usually, this deviation is small, but it can be significant when some kind of ar

### Some decimal numbers has no accurate float representation

```text
```sql
select sum(toFloat64(0.45)) from numbers(10000);
---
title: "4499.999999999948 "
Expand Down Expand Up @@ -96,7 +96,7 @@ description: >

The same number can have several floating-point representations and because of that you should not compare Floats directly

```text
```sql
select toFloat32(0.1)*10 = toFloat32(0.01)*100;
---
title: "0"
Expand Down
Expand Up @@ -14,7 +14,7 @@ MATERIALIZED VIEWs in ClickHouse behave like AFTER INSERT TRIGGER to the left-mo

First you create the table which will store the data calculated by MV explicitly, and after that create materialized view itself with TO syntax.

```text
```sql
CREATE TABLE target ( ... ) Engine=ReplacingSummingMergeTree;

CREATE MATERIALIZED VIEW mv_source2target TO target
Expand All @@ -34,7 +34,7 @@ MATERIALIZED VIEWs in ClickHouse behave like AFTER INSERT TRIGGER to the left-mo
* With manual backfilling, you have much better control on the process - you can do it in parts, adjust settings etc.
* In case of some failure 'in the middle (for example due to timeouts), it's hard to understand the state of the MV.

```text
```sql
CREATE MATERIALIZED VIEW mv_source2target TO target
AS SELECT ... FROM source WHERE cond > ...

Expand Down
Expand Up @@ -12,7 +12,7 @@ One of the best options is to fill one partition at a time, and if it breaks you

If you need to construct a single partition from several sources - then the following approach may be the best.

```text
```sql
CREATE TABLE mv_import AS mv;
INSERT INTO mv_import SELECT * FROM huge_table WHERE toYYYYMM(ts) = 202105;
/* or other partition expression*/
Expand Down
Expand Up @@ -92,7 +92,7 @@ Pros and cons:
![(minus)](/assets/forbidden.png) Works only when the source and the destination clickhouse servers share the same zookeeper (without chroot)
![(minus)](/assets/forbidden.png) Needs to access zookeeper and ClickHouse replication ports: (`interserver_http_port` or `interserver_https_port`)

```text
```sql
ALTER TABLE table_name FETCH PARTITION partition_expr FROM 'path-in-zookeeper'
```

Expand Down
Expand Up @@ -40,7 +40,7 @@ However, you can create the target tables manually and specify the engine in the
Clickhouse-copier uses ZooKeeper to keep track of the progress and to communicate between workers.
Here is a list of queries that you can use to see what’s happening.

```text
```sql
--task-path /clickhouse/copier/task1

-- The task config
Expand Down
Expand Up @@ -45,7 +45,7 @@ Clickhouse-copier uses the engine from the task configuration file for these pur

Here is an example of SELECT that clickhouse-copier runs to get the sixth of ten chunks of data:

```text
```sql
WHERE (<the PARTITION BY clause> = (<a value of the PARTITION BY expression> AS partition_key))
AND (cityHash64(<the ORDER BY clause>) % 10 = 6 )
```
Expand All @@ -60,7 +60,7 @@ However, you can create the intermediate tables manually with the same engine as
The default value for `number_of_splits` is 10.
You can change this parameter in the `table` section of the task configuration file. We recommend setting it to 1 for smaller tables.

```text
```xml
<cluster_push>target_cluster</cluster_push>
<database_push>target_database</database_push>
<table_push>target_table</table_push>
Expand All @@ -73,7 +73,7 @@ You can change this parameter in the `table` section of the task configuration f
Clickhouse-copier uses ZooKeeper to keep track of the progress and to communicate between workers.
Here is a list of queries that you can use to see what’s happening.

```text
```sql
--task-path /clickhouse/copier/task1

-- The task config
Expand Down
Expand Up @@ -69,7 +69,7 @@ cat /etc/clickhouse-server/users.d/enable_access_management_for_user_default.xml

BTW, you can define any macro in your configuration and use them in Zookeeper paths

```text
```xml
ReplicatedMergeTree('/clickhouse/{cluster}/tables/my_table','{replica}')
```

Expand Down Expand Up @@ -218,7 +218,7 @@ You can start multiple **clickhouse-server** each with own **--config-file.**

For example:

```text
```bash
/usr/bin/clickhouse-server --config-file /etc/clickhouse-server-node1/config.xml
/etc/clickhouse-server-node1/ config.xml ... users.xml
/etc/clickhouse-server-node1/config.d/disable_open_network.xml
Expand All @@ -232,7 +232,7 @@ For example:

If you need to run multiple servers for CI purposes you can combine all settings in a single fat XML file and start ClickHouse without config folders/sub-folders.

```text
```bash
/usr/bin/clickhouse-server --config-file /tmp/ch1.xml
/usr/bin/clickhouse-server --config-file /tmp/ch2.xml
/usr/bin/clickhouse-server --config-file /tmp/ch3.xml
Expand All @@ -242,7 +242,7 @@ Each ClickHouse instance must work with own **data-folder** and **tmp-folder**.

By default ClickHouse uses **/var/lib/clickhouse/**. It can be overridden in path settings

```markup
```xml
<path>/data/clickhouse-ch1/</path>

<tmp_path>/data/clickhouse-ch1/tmp/</tmp_path>
Expand Down
Expand Up @@ -13,13 +13,13 @@ More safer way:
* Wait until all already running queries would finish execution on it.
It’s possible to check it via query:

```text
```sql
SHOW PROCESSLIST;
```

* Run sync replica query in related shard replicas via query:

```text
```sql
SYSTEM SYNC REPLICA db.table;
```

Expand Down
Expand Up @@ -10,7 +10,7 @@ Article on docs site:

Check number of followers:

```text
```bash
echo mntr | nc zookeeper 2187 | grep foll
zk_synced_followers 2
zk_synced_non_voting_followers 0
Expand Down
Expand Up @@ -70,13 +70,13 @@ And now we have an exception that we lost all metadata in zookeeper. It is time

1. Detach replicated table.

```text
```sql
DETACH TABLE table_repl;
```

2. Save the table’s attach script and change engine of replicated table to non-replicated \*mergetree analogue. Table definition is located in the ‘metadata’ folder, ‘`/var/lib/clickhouse/metadata/default/table_repl.sql`’ in our example. Please make a backup copy and modify the file as follows:

```text
```sql
ATTACH TABLE table_repl
(
`number` UInt32
Expand All @@ -89,7 +89,7 @@ And now we have an exception that we lost all metadata in zookeeper. It is time

Needs to be replaced with this:

```text
```sql
ATTACH TABLE table_repl
(
`number` UInt32
Expand All @@ -102,19 +102,19 @@ And now we have an exception that we lost all metadata in zookeeper. It is time

3. Attach non-replicated table.

```text
```sql
ATTACH TABLE table_repl;
```

4. Rename non-replicated table.

```text
```sql
RENAME TABLE table_repl TO table_repl_old;
```

5. Create a new replicated table. Take the saved attach script and replace ATTACH with CREATE, and run it.

```text
```sql
CREATE TABLE table_repl
(
`number` UInt32
Expand All @@ -127,7 +127,7 @@ And now we have an exception that we lost all metadata in zookeeper. It is time

6. Attach parts from old table to new.

```text
```sql
ALTER TABLE table_repl ATTACH PARTITION 1 FROM table_repl_old;

ALTER TABLE table_repl ATTACH PARTITION 2 FROM table_repl_old;
Expand Down
Expand Up @@ -14,14 +14,14 @@ Unfortunately, that change leads to compatibility issues - automatic dependencie

When you try to install versions 20.8 or older from Altinity repo -

```text
```bash
version=20.8.12.2-1.el7
yum install clickhouse-client-${version} clickhouse-server-${version}
```

yum outputs smth like

```text
```bash
yum install clickhouse-client-${version} clickhouse-server-${version}
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
Expand Down Expand Up @@ -66,7 +66,7 @@ As you can see yum has an issue with resolving `clickhouse-server-common` depend

add `--setopt=obsoletes=0` flag to the yum call.

```text
```bash
version=20.8.12.2-1.el7
yum install --setopt=obsoletes=0 clickhouse-client-${version} clickhouse-server-${version}
---
Expand All @@ -81,12 +81,12 @@ Alternatively, you can add `obsoletes=0` into `/etc/yum.conf`.

### To update to new ClickHouse version (from old packaging schema to new packaging schema)

```text
```bash
version=21.1.7.1-2
yum install clickhouse-client-${version} clickhouse-server-${version}
```

```text
```bash
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: centos.hitme.net.pl
Expand All @@ -105,30 +105,30 @@ It is caused by wrong dependencies resolution.

To update to the latest available version - just add `clickhouse-server-common`:

```text
```bash
yum install clickhouse-client clickhouse-server clickhouse-server-common
```

This way the latest available version will be installed (even if you will request some other version explicitly).

To install some specific version remove old packages first, then install new ones.

```text
```bash
yum erase clickhouse-client clickhouse-server clickhouse-server-common clickhouse-common-static
version=21.1.7.1
yum install clickhouse-client-${version} clickhouse-server-${version}
```

### Downgrade from new version to old one

```text
```bash
version=20.8.12.2-1.el7
yum downgrade clickhouse-client-${version} clickhouse-server-${version}
```

will not work:

```text
```bash
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: ftp.agh.edu.pl
Expand Down Expand Up @@ -162,7 +162,7 @@ Error: Package: clickhouse-server-20.8.12.2-1.el7.x86_64 (Altinity_clickhouse-al

Remove packages first, then install older versions:

```text
```bash
yum erase clickhouse-client clickhouse-server clickhouse-server-common clickhouse-common-static
version=20.8.12.2-1.el7
yum install --setopt=obsoletes=0 clickhouse-client-${version} clickhouse-server-${version}
Expand Down

0 comments on commit 6fe6a9e

Please sign in to comment.