Skip to content

Instantly share code, notes, and snippets.

@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/
@leifwalsh
leifwalsh / resize
Created August 7, 2013 21:08
resize ubuntu 12.10 root partition (after resizing virtualbox disk)
$ fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 137.4 GB, 137438953472 bytes
255 heads, 63 sectors/track, 16709 cylinders, total 268435456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007427a
diff --git a/src/mongo/db/security.cpp b/src/mongo/db/security.cpp
index 14408d2..dac1a54 100644
--- a/src/mongo/db/security.cpp
+++ b/src/mongo/db/security.cpp
@@ -24,6 +24,7 @@
#include "mongo/db/client.h"
#include "mongo/db/curop.h"
#include "mongo/db/dbhelpers.h"
+#include "mongo/db/storage/exception.h"
@leifwalsh
leifwalsh / stacks
Created July 27, 2013 16:13
add stacktrace to RetryableException constructor to track down an auth issue
diff --git a/src/mongo/db/storage/env.cpp b/src/mongo/db/storage/env.cpp
index 3010888..9682308 100644
--- a/src/mongo/db/storage/env.cpp
+++ b/src/mongo/db/storage/env.cpp
@@ -45,6 +45,8 @@ namespace mongo {
namespace storage {
+ SimpleMutex RetryableException::_m("RetryableException");
+
establishing lock order ReplicaSetMonitor before DBConnectionPool in 30999 thread 2063
30999: ReplicaSetMonitor DBConnectionPool
history since first lock:
m30999| 2063 ENTERING ReplicaSetMonitor:
m30999| 2063 0xa9858b 0x82f4d1 0x83014a 0x853c76 0x9c2fc6 0x9c8d51 0xa2e1f8 0xa24a18 0xa0bb97 0x81c7c3 0xa8917e 0x7f6b5f26edd2 0x7f6b5e57fcdd
m30999| 2063 /home/leif/git/mongo-vanilla/mongos(_ZN5mongo15printStackTraceERSo+0x27) [0xa9858b]
m30999| 2063 /home/leif/git/mongo-vanilla/mongos(_ZN5mongo13MutexDebugger8enteringEPKc+0x197) [0x82f4d1]
m30999| 2063 /home/leif/git/mongo-vanilla/mongos(_ZN5mongo5mutex11scoped_lockC1ERS0_+0x74) [0x83014a]
m30999| 2063 /home/leif/git/mongo-vanilla/mongos(_ZN5mongo17ReplicaSetMonitor6removeERKSsb+0x28) [0x853c76]
m30999| 2063 /home/leif/git/mongo-vanilla/mongos(_ZN5mongo11dbgrid_cmds14RemoveShardCmd3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x18f4) [0x9c2fc6]