DB

wal recovery would cleanup at least the first WAL

这段时间跟同事尝试修复长期以来项目中遗留的Rocksdb的Case,遇到些有意思的Case,这里记录一下。

some tips for rocksdb case fixing

  1. 对于不支持-march=native环境的,可以编译时export USE_SSE=1.避免类似no such instruction: shlx %r13,%rax,%rax'`的问题。

  2. 对于rocksdb的测试case,想保留测试db的,可以搞个KEEP_DB环境变量。测试类会根据这个环境变量决定是否清理测试DB。

some details about rocksdb::LRUCache

最近有同事找我讨论问题,觉得挺有趣的记录一下。

rocksdb::LRUHandle::key()的历史

第一个问题是rocksdb::LRUHandle::key(), 这个函数返回该handle内部存储的key,但为啥某些情况下却返回value呢?

db笔记 - sse

background

we would set env var USE_SSE=1 when compiling Rocksdb, OTHERWISE it would always failed at linking stage where encountering errors of lack of some instructions such as: no such instruction: shlx %rdx,%rax,%rax'`. but what the fuck is USE_SSE ?

笔记:一些日常cheatsheet

日常cheatsheet~

  • run valgrind for a program
valgrind --tool=memcheck --leak-check=full --log-file=leak.log --soname-synonyms=somalloc=NONE <some_exe> [<some_exe_args>]
  • run tcpdump to capture mysql queries:
tcpdump -r /tmp/a.cap -A -S -n -nn  | grep -i -E "select|insert|update|delete|replace" | sed 's%\(.*\)\([.]\{4\}\)\(.*\)%\3%' | less
  • python scripts:
python -m SimpleHTTPServer 8123
wget -c -r -nH -m --limit-rate=400m "http://ip:8123/xxxx"
python -c 'from zlib import crc32; print crc32("1476777") % 1024'
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import json
data = ""
for line in sys.stdin:
        data += line
text = json.loads(data)
print(text)
  • tee with a pipe output to screen and a file
echo "hello" | tee abc.txt
  • ps

  • top

  • tasr

  • sar