View test_vma.c
#include <sys/mman.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <assert.h> | |
#include <string.h> | |
void* mmap_hint() | |
{ |
View use_compact_format_in_distributed_parts_names=0.error.sql
SELECT * | |
FROM system.distribution_queue | |
FORMAT Vertical | |
Query id: bb17b27d-c681-4826-8eb6-607a960414f3 | |
Row 1: | |
────── | |
database: default | |
table: dist |
View atomic_benchmark.cpp
/// https://github.com/aosp-mirror/platform_bionic/blob/master/benchmarks/atomic_benchmark.cpp | |
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
View optimize_skip_unused_shard.sql
select version(); | |
-- ┌─version()───┐ | |
-- │ 20.3.15.133 │ | |
-- └─────────────┘ | |
create table ranges_data engine=Memory() as select number key, number value from numbers(100); | |
create dictionary default.ranges_dict (key UInt64, value UInt64 default 1) primary key key source(clickhouse(host '127.0.0.1' port 9000 table 'ranges_data' db 'default' user 'default' password '')) lifetime(0) layout(cache(size_in_cells 100)); | |
create table dist as system.one engine=Distributed('test_cluster_two_shards', system, one, dictGetUInt64('default.ranges_dict', 'value', toUInt64(dummy))); | |
SELECT * |
View replxx-test-client-history-save.sh
#!/usr/bin/env bash | |
# XXX: cannot use expect since we need two clients | |
# XXX: requires bash 4.4+ | |
function assert() | |
{ | |
if ! "$@"; then | |
echo "'$*' failed" >&2 | |
exit 1 |
View rand.c
// gist for showing that rand() with global lock is slower ~60x times | |
// (came to this for librdkafa random partitioning with producer per group, and eventually program has ~1200 threads) | |
// | |
// $ g++ -DRAND -o rand -O3 -pthread rand.cpp | |
// $ g++ -DRAND_R -o rand_r -O3 -pthread rand.cpp | |
// | |
// $ time ./rand | |
// | |
// real 0m2.336s | |
// user 0m2.685s |
View test-MADV_DONTNEED.c
// Gist to check possible issues with MADV_DONTNEED | |
// For example it does not supported by qemu user | |
// There is a patch for this [1], but it hasn't been applied. | |
// [1]: https://lists.gnu.org/archive/html/qemu-devel/2018-08/msg05422.html | |
#include <sys/mman.h> | |
#include <stdio.h> | |
#include <stddef.h> | |
#include <assert.h> | |
#include <string.h> |
View 01502_jemalloc_percpu_arena.tsan.log
2020-09-22 00:48:35 01502_jemalloc_percpu_arena: [ FAIL ] 7.43 sec. - return code 66 | |
2020-09-22 00:48:35 ================== | |
2020-09-22 00:48:35 WARNING: ThreadSanitizer: data race (pid=384) | |
2020-09-22 00:48:35 Write of size 8 at 0x7b1000008ff8 by main thread (mutexes: write M1432): | |
2020-09-22 00:48:35 #0 operator delete(void*, unsigned long) <null> (clickhouse+0x8085f1e) | |
2020-09-22 00:48:35 #1 Poco::Logger::~Logger() /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Logger.cpp:39:1 (clickhouse+0x14dc78ce) | |
2020-09-22 00:48:35 #2 non-virtual thunk to Poco::Logger::~Logger() /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Logger.cpp (clickhouse+0x14dc78ce) | |
2020-09-22 00:48:35 #3 Poco::RefCountedObject::release() const /build/obj-x86_64-linux-gnu/../contrib/poco/Foundation/include/Poco/RefCountedObject.h:82:24 (clickhouse+0x14dcb797) | |
2020-09-22 00:48:35 #4 Poco::Logger::shutdown() /build/obj-x86_64-linux-gnu/../contrib/poco/Found |
View jemalloc-percpu-arena-test.c
/** | |
* Reproducer for percpu_arena jemalloc issue [1]. | |
* Requires debug jemalloc (w/o NDEBUG to include assert()s) | |
* | |
* [1]: https://github.com/jemalloc/jemalloc/pull/1676 | |
* | |
* $ gcc -g3 -o /tmp/sched /tmp/sched.c | |
* $ MALLOC_CONF=percpu_arena:percpu LD_PRELOAD=jemalloc/build/lib/libjemalloc.so taskset --cpu-list 3 /tmp/sched | |
* <jemalloc>: ../src/jemalloc.c:321: Failed assertion: "ind <= narenas_total_get()" | |
* Aborted (core dumped) |
View docker-compose-oneshot.sh
function array_exist() | |
{ | |
local needle="$1" | |
shift | |
local i | |
for i; do | |
[ "$needle" = "$i" ] && return 0 || continue | |
done | |
return 1 |
NewerOlder