Skip to content

Instantly share code, notes, and snippets.

@leifwalsh
leifwalsh / A_results.txt
Last active September 19, 2020 13:49
mcs lock: userspace c++11 implementation of http://lwn.net/Articles/590243/. seems to be awful---far worse than normal spinlock---with nthreads > ncpus
# clang version 3.4 (tags/RELEASE_34/final)
# Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
spinlock 1: 3925ms
spinlock 2: 25665ms
spinlock 3: 27722ms
spinlock 4: 42727ms
std::mutex 1: 5526ms
std::mutex 2: 17672ms
std::mutex 3: 31038ms
std::mutex 4: 36890ms
@leifwalsh
leifwalsh / gist:4324080
Created December 18, 2012 01:13
error building mariadb-5.5.28a with CC=cc CXX=c++ on osx
Linking C executable async_example
Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
yaSSL::read_file(yaSSL::SSL_CTX*, char const*, int, yaSSL::CertType) in libmysqlclient.a(ssl.cpp.o)
_yaEVP_BytesToKey in libmysqlclient.a(ssl.cpp.o)
_yaSSLv3_client_method in libmysqlclient.a(ssl.cpp.o)
_yaSSLv3_server_method in libmysqlclient.a(ssl.cpp.o)
_yaTLSv1_server_method in libmysqlclient.a(ssl.cpp.o)
_yaTLSv1_client_method in libmysqlclient.a(ssl.cpp.o)
_yaTLSv1_1_server_method in libmysqlclient.a(ssl.cpp.o)
@leifwalsh
leifwalsh / A_instructions.md
Created January 11, 2014 23:02
got http://symas.com/mdb/microbench/ lightly hooked up to https://github.com/Tokutek/ft-index. Used leveldb vanilla code for scaffolding, may be missing some benchmark pieces (like Shuffle).

To build and run:

git clone https://github.com/Tokutek/ft-index
mkdir build-tokukv
pushd build-tokukv
cmake \
  -D CMAKE_BUILD_TYPE=Release \
  -D TOKU_DEBUG_PARANOID=OFF \
 -D USE_VALGRIND=OFF \
@properties.renderer
def get_a(props):
return "Hello, %s" % props.getProperty("a")
@properties.renderer
def get_cmd(props):
return ["echo", get_a]
factory = factory.BuildFactory([shell.ShellCommand(command=get_cmd)])
@leifwalsh
leifwalsh / tokumx-compression-estimator.sh
Created December 10, 2013 21:01
run like `./tokumx-compression-estimator.sh /data/db/test.3` and it'll print out the compression ratio you can expect by migrating from MongoDB to TokuMX
#!/bin/bash
usage() {
echo 1>&2 "usage: $0 [--bnsize=BYTES[K]] /path/to/file.N"
}
bnsize=64K
while [ $# -gt 1 ] ; do
arg=$1; shift
if [[ $arg =~ --(.*)=(.*) ]] ; then
k=${BASH_REMATCH[1]}; v=${BASH_REMATCH[2]}
#include <chrono>
#include <iostream>
#include <string>
#include <boost/scoped_ptr.hpp>
#include <boost/optional.hpp>
#include <boost/utility/in_place_factory.hpp>
class Thing {
int x;
@leifwalsh
leifwalsh / gdb.pl
Created November 15, 2013 15:57
eliminate duplicate thread stacks from gdb "thread apply all bt"
#!/usr/bin/perl -w
use strict;
use Digest::MD5 qw(md5_hex);
my @threads;
my $curr_thd = undef;
$\ = "\n";
[Settings]
gtk-application-prefer-dark-theme = false
gtk-theme-name = Default
gtk-fallback-icon-theme = gnome
gtk-icon-theme-name = Default
gtk-font-name = Deja Vu Sans 10
@leifwalsh
leifwalsh / docker-tokumx.sh
Last active December 26, 2015 05:59
tokumx docker image
$ docker run -d leifw/ubuntu-tokumx
$ mongo localhost:$(docker port $(docker ps | awk '/leifw\/ubuntu-tokumx/ {print $1}') 27017)
TokuMX mongo shell v1.3.0-mongodb-2.4.7
connecting to: localhost:49154/test
> db.runCommand('buildInfo').tokumxVersion
1.3.0
@leifwalsh
leifwalsh / gist:7010507
Created October 16, 2013 16:11
parallel test log
% python2 buildscripts/smoke.py parallel
running /home/leif/git/mongo/mongod --port 27999 --dbpath /data/db/sconsTests/ --setParameter enableTestCommands=1 --debug
Wed Oct 16 12:02:43.183 nssize is a deprecated parameter
Wed Oct 16 12:02:43.186 [initandlisten] TokuMX starting : pid=25368 port=27999 dbpath=/data/db/sconsTests/ 64-bit host=cavil
Wed Oct 16 12:02:43.186 [initandlisten] TokuMX mongod server v1.3.0-pre--mongodb-2.4.7, using TokuKV rev notokukvversion
Wed Oct 16 12:02:43.186 [initandlisten] git version: b241f06d9e94ceeaf351a2d8eaea785706842f41
Wed Oct 16 12:02:43.186 [initandlisten] build info: Linux cavil 3.11.4-1-ARCH #1 SMP PREEMPT Sat Oct 5 21:22:51 CEST 2013 x86_64 BOOST_LIB_VERSION=1_49
Wed Oct 16 12:02:43.186 [initandlisten] options: { dbpath: "/data/db/sconsTests/", debug: true, port: 27999, setParameter: [ "enableTestCommands=1" ] }
Wed Oct 16 12:02:43.221 [initandlisten] [tokumx] startup
Wed Oct 16 12:02:43 2013 Tokudb recovery starting in env /data/db/sconsTests/