Skip to content

Instantly share code, notes, and snippets.

diff --git a/tests/queries/0_stateless/02845_threads_count_in_distributed_queries.sql.j2 b/tests/queries/0_stateless/02845_threads_count_in_distributed_queries.sql.j2
index 1784cc96c97..06a691dc7f4 100644
--- a/tests/queries/0_stateless/02845_threads_count_in_distributed_queries.sql.j2
+++ b/tests/queries/0_stateless/02845_threads_count_in_distributed_queries.sql.j2
@@ -18,7 +18,7 @@ select count() from remote('127.0.0.1:9000', view(
{% for n in range(379) -%}
SELECT * FROM system.one {{ "UNION ALL" if not loop.last }}
{% endfor -%}
- )) SETTINGS log_comment='check_concurrency_in_remote_queries1';
+ )) SETTINGS log_comment='check_concurrency_in_remote_queries1', prefer_localhost_replica=1;
@azat
azat / 02845_threads_count_in_distributed_queries.sql
Created September 27, 2023 09:48
02845_threads_count_in_distributed_queries.sql
SELECT
initial_query_id,
query_id,
peak_threads_usage,
Settings
FROM system.query_log
WHERE (log_comment = 'check_concurrency_in_remote_queries4') AND (type = 'QueryFinish')
Query id: 2381cef7-f23f-4577-a5cd-2b93c07158dc
//
// Created by tonyyxliu on 7/11/23.
//
// This is a test for the problem related to the unexpected delay of libevent
// timeout event callback trigger
//
// Compile this program in release mode and link it with two libraries: 'event' and 'glog'
//
#include <iostream>
@azat
azat / log
Last active July 17, 2023 11:09
readlink qemu linux-user handling
$ sudo arch-chroot ./ /qemu-x86_64-static /main
==> WARNING: ./ is not a mountpoint. This may have undesirable side effects.
readlink(/proc/self/exe) => /main (len: 5)
readlink(/proc/self) => 27679 (len: 5)
readlink(/proc/1/exe) => /main (len: 5)
realpath(/proc/self/exe) => /qemu-x86_64-static
AT_EXECFN = /main
$ sudo arch-chroot ./ /qemu-x86_64-static -strace /main
==> WARNING: ./ is not a mountpoint. This may have undesirable side effects.
#!/usr/bin/env python3
# https://gist.github.com/azat/fe1c087d2bc25f1b831281e1ff80ff9b
import argparse
# Overhead for sparsehash [1].
#
# [1]: https://tristanpenman.com/blog/posts/2017/10/11/sparsehash-internals/
SPARSEHASH_ELEMENT_OVERHEAD_64BIT = 2.66666667
SPARSEHASH_ELEMENT_OVERHEAD_32BIT = 2
$ git di
diff --git a/client.cpp b/client.cpp
index 294c8b7..cf347fe 100644
--- a/client.cpp
+++ b/client.cpp
@@ -32,7 +32,7 @@
#include <event2/util.h>
#include <event2/event.h>
-#include <sanitizer/lsan_interface.h>
#!/usr/bin/env python3
# Compare prices for cloud storage providers:
# - S3 - AWS S3 from Amazon
# https://aws.amazon.com/s3/pricing/
# - GS/GCS - Google Cloud Storage
# https://cloud.google.com/storage/pricing#north-america
# - R2 - R2 from CloudFrame
# https://developers.cloudflare.com/r2/platform/pricing/
#include <pthread.h>
#include <dlfcn.h>
#include <stdlib.h>
// force jemalloc
void __attribute__((used)) force_jemalloc()
{
/// calloc() is used in older glibc in dlsym()
/// force this symbol from the jemalloc to trigger endless loop
(void)calloc(0, 0);
@azat
azat / test-dlsym.c
Created December 31, 2022 22:35
different behavior of dlsym since glibc 2.36
#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>
int main()
{
void *p = dlsym(RTLD_NEXT, "__pthread_mutex_lock");
printf("__pthread_mutex_lock: %p (via RTLD_NEXT)\n", p);
return 0;
}
@azat
azat / test-asan.cpp
Created December 31, 2022 22:34
ASan does not work with glibc 2.36+
#include <pthread.h>
int main()
{
// something broken in ASan in interceptor for __pthread_mutex_lock
// and only since glibc 2.36, and for pthread_mutex_lock everything is OK
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
return __pthread_mutex_lock(&mutex);
}