Skip to content
robertking edited this page Jun 12, 2021 · 4 revisions

This is the repository of MySQL evaluation code for the Obi-Wan project.

Branches

  • orbit: This branch is the main branch for orbit version of MySQL deadlock checker.

  • tracing: This branch includes extra code for tracing. Some commits are cherry-picked from this branch back to the orbit branch. If some development is carried on in orbit branch, we may merge orbit branch into tracing branch to synchronize changes while maintaining tracing code. Current strategy is we do not merge tracing code to orbit branch code.

    • To get the tracing information, you can search for #define OUTPUT_ORBIT_ALLOC 0 macro (including orbit.c), and toggle the macro gate.
    • Supported traces are
      • Orbit pool allocation trace
      • Trx create/free/allocate trace (there are some magic numbers right now...)
      • Checker lock object access trace
  • fork: This branch was used for fork version of MySQL deadlock checker benchmark.

  • (legacy) orbit-trx: This was used for HotOS evaluation to test using one dummy page for each trx in a highly concurrent execution environment.

Compilation

Required orbit files

In order to compile orbit version of MySQL, you need to obtain two files orbit.h and orbit.c from the obiwan-userlib repository.

Then put them inside storage/innobase/include/ and storage/innobase/lock/ respectively. The CMakeLists.txt file has already been modified to include orbit.c as a source file. Ideally, orbit.h should be in the system include directory, and the compiler will handle linking to orbit.o or orbit.so in system library.

Compile Script Template

Change the srcdir, dest, and boost include directory.

#!/bin/bash

srcdir=/path/to/mysql-src
dest=/path/to/compile-site
build=$dest/build
dist=$dest/dist
data=$dest/data

mkdir -p $build $dist $data
cd $build

cmake $srcdir  -DCMAKE_INSTALL_PREFIX=$dist \
  -DMYSQL_DATADIR=$data -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DMYSQL_MAINTAINER_MODE=false \
  -DBOOST_INCLUDE_DIR=/path/to/boost_1_59_0

Then type make -j$(nproc) && make install and you are ready to go.

Running

Initialization

Reference: MySQL 5.7 Reference Manual - Initializing the Data Directory

  1. Initialize data directory:
bin/mysqld --initialize --user=root \
  --basedir=/path/to/dist \
  --datadir=/path/to/data
  1. Initialize the root password:

Start a mysqld server and log into the server using a generated password from the last step. You can also use --initialize-insecure in the last step to initialize with empty password (see Reference).

mysql -u root -p
# Enter password: (enter the random root password here)

# Or, skip password if you use `--initialize-insecure`
mysql -u root --skip-password

Initialize the root user password with ALTER USER. Note that MySQL does not use PEM by default, thus root user is different from system root user.

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

Obi-Wan experiments typically use password '123456'.

System Environment

To run orbit version of MySQL, you need a Linux with orbit support. Checkout obiwan-kernel wiki for more information.

MySQL Configuration File Template

Replace the paths and put this file at /path/to/compile-site/dist/etc/my.cnf. Note that you need to manually create the etc subdirectory.

# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file        = /tmp/mysqld.pid
socket          = /tmp/mysql.sock
datadir         = /path/to/compile-site/data
log-error       = /path/to/compile-site/dist/error.log
# By default we only accept connections from localhost
bind-address    = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_deadlock_detect=1
max_connections=500

Environment Modules Template

If you use environment modules, you can use the following template and replace the prefix.

#%Module1.0

conflict mysql

set prefix /path/to/compile-site/dist

prepend-path PATH ${prefix}/bin
prepend-path INCLUDE ${prefix}/include
prepend-path LIBRARY_PATH ${prefix}/lib
prepend-path LD_LIBRARY_PATH ${prefix}/lib
prepend-path MANPATH ${prefix}/man

Experiment scripts & results

The experiment scripts and results are available in the obiwan-archive repository.