Skip to content

Instantly share code, notes, and snippets.

View alexey-milovidov's full-sized avatar

Alexey Milovidov alexey-milovidov

View GitHub Profile
~/work/bloaty/build$ ./bloaty /usr/bin/clickhouse -d compileunits
FILE SIZE VM SIZE
-------------- --------------
61.8% 1.29Gi 50.4% 264Mi [3682 Others]
6.2% 131Mi 11.5% 60.6Mi ../dbms/src/Functions/GatherUtils/concat.cpp
4.3% 92.5Mi 4.0% 20.7Mi ../dbms/src/Functions/GatherUtils/has.cpp
2.7% 57.9Mi 11.0% 57.9Mi [section .text]
2.6% 55.9Mi 0.0% 0 [section .strtab]
2.2% 47.1Mi 2.1% 11.2Mi ../dbms/src/Functions/GatherUtils/sliceDynamicOffsetBounded.cpp
2.1% 44.3Mi 1.9% 9.77Mi ../dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetBounded.cpp
[
{
"width": "500",
"target": [
"highestAverage(one_min.example??-??-?_yandex_ru.cpuload.us,5)"
],
"_salt": "1432580254.284",
"height": "400"
},
{
libunwind: __unw_get_proc_info(cursor=0x7fba999f40b0, &info=0x7fba999f4068)
libunwind: __unw_get_proc_name(cursor=0x7fba999f40b0, &buf=0x7fba999f4260, bufLen=512)
libunwind: __unw_get_reg(cursor=0x7fba999f40b0, regNum=-1, &value=0x7fba999f4050)
libunwind: unwind_phase1(ex_ojb=0x7fba8b3b0220): pc=0xfc00eb4, start_ip=0xfc00e50, func=__cxa_throw, lsda=0x0, personality=0x0
libunwind: __unw_step(cursor=0x7fba999f40b0)
parseInstructions(instructions=0x82f7b38)
DW_CFA_def_cfa(reg=7, offset=8)
DW_CFA_offset(reg=16, offset=-8)
DW_CFA_nop
DW_CFA_nop
#include <vector>
#include <cstdint>
using uint8_no_alias = unsigned int __attribute__((mode(QI)));
struct uint8_struct
{
uint8_t value;
operator const uint8_t & () const { return value; }
Чек-лист для тем:
Университет (ВШЭ, УрФУ, ICT).
Название темы: англоязычное, русскоязычное.
Направление: C++ разработка сервера ClickHouse; web-разработка инструментов; сравнительное исследование систем.
ФИО студентов, курс, группа, e-mail, Telegram, GitHub.
Тема подтверждена; подписана.
Для групповых проектов - кто лидер группы.
Есть ли опыт разработки ClickHouse.
Является ли сотрудником Яндекса.
:) WITH 'It is the latest occurrence of the Southeast Asian haze, the issue that occurs in constant intensity during every wet season. It has mainly been caused by forest fires resulting from illegal slash-and-burn clearing performed on behalf of the palm oil industry in Kazakhstan, principally on the islands, which then spread quickly in the dry season.' AS str, alphaTokens(str) AS tokens, arrayMap(i -> [tokens[i], tokens[i + 1], tokens[i + 2]], arrayEnumerate(tokens)) AS shingles, arrayMap(x -> sipHash64(x, 1), shingles) AS hashes1, arrayMap(x -> sipHash64(x, 2), shingles) AS hashes2, sipHash64(arraySlice(arraySort(hashes1), 1, 5)) AS h1, sipHash64(arraySlice(arraySort(hashes2), 1, 5)) AS h2 SELECT h1, h2\G
WITH
'It is the latest occurrence of the Southeast Asian haze, the issue that occurs in constant intensity during every wet season. It has mainly been caused by forest fires resulting from illegal slash-and-burn clearing performed on behalf of the palm oil industry in Kazakhstan, principally on the

Wait-free каталог баз данных в ClickHouse.

Done 🚀

Implementation of wait-free database catalog in ClickHouse.

Зарезервирована для Александра Токмакова.

Манипуляции с каталогом баз данных: запросы CREATE TABLE, DROP TABLE, RENAME TABLE и DATABASE, требуют синхронизации с помощью блокировок. Эта синхронизация становится весьма сложной, так как на неё полагается много внутренних структур данных.

$ docker run --rm -it centos:7 /bin/bash
Unable to find image 'centos:7' locally
7: Pulling from library/centos
d8d02d457314: Pull complete
Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb
Status: Downloaded newer image for centos:7
[root@295dd8ae621f /]# yum install yum-utils
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirror.docker.ru
@alexey-milovidov
alexey-milovidov / profile_example.txt
Created July 30, 2019 00:07
Example of query profiling.
SELECT
count(),
arrayStringConcat(arrayMap(x -> concat(demangle(addressToSymbol(x)), '\n ', addressToLine(x)), trace), '\n') AS sym
FROM system.trace_log
WHERE (query_id = 'ebca3574-ad0a-400a-9cbc-dca382f5998c') AND (event_date = today())
GROUP BY trace
ORDER BY count() DESC
LIMIT 10
Row 1:

Счётчики, метрики и трейспоинты в ClickHouse (черновик).

Мотивация

В ClickHouse разным образом реализовано некоторое количество функциональности, имеющей общие черты. Это:

  • метрики на основе инкрементальных счётчиков (ProfileEvents);
  • метрики на основе количества одновременных процессов (Metrics);
  • метрики на основе асинхронно получаемых значений (AsynchronousMetrics);
  • ограничения на сложность выполнения запроса (встроены в Settings);
  • прогресс выполнения запроса (Progress, отправляется клиенту);