Skip to content

Instantly share code, notes, and snippets.

View BohuTANG's full-sized avatar

Bohu BohuTANG

View GitHub Profile
@BohuTANG
BohuTANG / datafuse-v0.4.76-nightly-numbers-table-performance
Created August 14, 2021 15:17
datafuse-v0.4.76-nightly-numbers-table-performance
bohu@thinkpad:~/github/cppwork/ClickHouse/build$ ./programs/clickhouse client
ClickHouse client version 21.9.1.1.
Connecting to localhost:9000 as user default.
Connected to datafuse server version 2021.5.0 revision 54405.
ClickHouse client version is older than ClickHouse server. It may lack support for new features.
datafuse :) SELECT avg(number) FROM numbers_mt(100000000000)
SELECT avg(number)
TODO
@BohuTANG
BohuTANG / rust-compile-panic
Created May 27, 2021 03:48
rust-compile-panic
thread 'rustc' panicked at 'assertion failed: `(left == right)`
left: `Some(Fingerprint(212923312148573672, 18320173992410164289))`,
right: `Some(Fingerprint(8537439170242672706, 4648092694241280842))`: found unstable fingerprints for evaluate_obligation(743076f0f8113f2e-37da7c23f6b6e546): Ok(EvaluatedToOkModuloRegions)', /rustc/bacf770f2983a52f31e3537db5f0fe1ef2eaa874/compiler/rustc_query_system/src/query/plumbing.rs:585:5
stack backtrace:
0: rust_begin_unwind
at /rustc/bacf770f2983a52f31e3537db5f0fe1ef2eaa874/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/bacf770f2983a52f31e3537db5f0fe1ef2eaa874/library/core/src/panicking.rs:92:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
@BohuTANG
BohuTANG / datafuse-0.4.1-numbers-table-performance
Last active July 2, 2021 08:59
datafuse-v0.4.40-nightly-numbers-table-performance with max_threads=16
ClickHouse client version 21.4.6.55 (official build).
Connecting to localhost:9000 as user default.
Connected to datafuse server version 2021.5.0 revision 54405.
ClickHouse client version is older than ClickHouse server. It may lack support for new features.
datafuse :)
SET max_threads = 16
@BohuTANG
BohuTANG / clickhouse-21.4.6-numbers-table-performance
Last active July 2, 2021 08:57
clickhouse-21.4.6-numbers-table-performance with max_threads=16
ClickHouse client version 21.4.6.55 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.4.6 revision 54447.
thinkpad :) set max_threads=16;
SET max_threads = 16
@BohuTANG
BohuTANG / bench.go
Created September 18, 2020 03:09
bench.go
package main
import (
"log"
"time"
"context"
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
@BohuTANG
BohuTANG / mysql-eof.txt
Last active September 18, 2020 03:09
mysql-eof.txt
1. docker mysql
sudo docker run -d -e MYSQL_ROOT_PASSWORD=123 mysql:5.7 mysqld --datadir=/var/lib/mysql --server-id=1 --log-bin=/var/lib/mysql/mysql-bin.log --gtid-mode=ON --enforce-gtid-consistency --disable-ssl --ssl=0
2. bench progoram
$ mkdir bench
$ mkdir bench/src
$ vim bench/src/run.go
```
package main
@BohuTANG
BohuTANG / MaterializeMySQL-sysbench.txt
Created August 27, 2020 03:00
MaterializeMySQL-sysbench.txt
1. install the GTID based replication ClickHouse
1.1 build from the master
1.2 download from https://clickhouse-builds.s3.yandex.net/0/cff92c8ad3dea2d96b1dfaadc76c3c10b3d701b2/clickhouse_build_check/report.html
2. prepare MySQL with GTID
2.1 $docker run -d -e MYSQL_ROOT_PASSWORD=123 mysql:5.7 mysqld --datadir=/var/lib/mysql --server-id=1 --log-bin=/var/lib/mysql/mysql-bin.log --gtid-mode=ON --enforce-gtid-consistency
2.2 mysql> create database sbtest;
3. run sysbench prepare
$docker run --rm=true --name=sb-prepare severalnines/sysbench sysbench --db-driver=mysql --oltp-table-size=100 --oltp-tables-count=4 --threads=1 --mysql-host=172.17.0.2 --mysql-port=3306 --mysql-user=root --mysql-password=123 /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua prepare
@BohuTANG
BohuTANG / mysql-ck-replication-fuzz.sql
Created May 28, 2020 14:25
mysql-ck-replication-fuzz.sql
-- copy from https://github.com/Altinity/clickhouse-mysql-data-reader/blob/master/docs/manual.md#mysql-data-types
RESET MASTER;
DROP DATABASE IF EXISTS dbtest;
CREATE DATABASE dbtest;
USE dbtest;
CREATE TABLE datatypes(
@BohuTANG
BohuTANG / clickhouse-jdbc-test.java
Last active April 2, 2020 16:09
clickhouse-jdbc-test.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
class JavaConnectorTest {
private static final String CREATE_TABLE_SQL = "CREATE TABLE IF NOT EXISTS default.test1 (age Int32, name String) Engine = Memory";
private static final String INSERT_SQL = "INSERT INTO default.test1 VALUES(33, 'jdbc'),(44, 'ck')";