Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install sysbench05plus package in a separate path from sysbench. #1338

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions perfkitbenchmarker/linux_benchmarks/mysql_service_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@
MYSQL_ROOT_PASSWORD_PREFIX = 'Perfkit8'
MYSQL_PORT = '3306'

PREPARE_SCRIPT_PATH = '/share/doc/sysbench/tests/db/parallel_prepare.lua'
OLTP_SCRIPT_PATH = '/share/doc/sysbench/tests/db/oltp.lua'

SYSBENCH_RESULT_NAME_DATA_LOAD = 'sysbench data load time'
SYSBENCH_RESULT_NAME_TPS = 'sysbench tps'
SYSBENCH_RESULT_NAME_LATENCY = 'sysbench latency'
Expand Down Expand Up @@ -281,9 +278,9 @@ def _IssueSysbenchCommand(vm, duration):
"""
stdout = ''
stderr = ''
oltp_script_path = sysbench05plus.PathPrefix(vm) + OLTP_SCRIPT_PATH
oltp_script_path = sysbench05plus.OLTP_SCRIPT_PATH
if duration > 0:
run_cmd_tokens = ['sysbench',
run_cmd_tokens = ['%s' % sysbench05plus.SYSBENCH05PLUS_PATH,
'--test=%s' % oltp_script_path,
'--mysql_svc_oltp_tables_count=%d' %
FLAGS.mysql_svc_oltp_tables_count,
Expand Down Expand Up @@ -345,8 +342,8 @@ def _RunSysbench(vm, metadata):
# Provision the Sysbench test based on the input flags (load data into DB)
# Could take a long time if the data to be loaded is large.
data_load_start_time = time.time()
prepare_script_path = sysbench05plus.PathPrefix(vm) + PREPARE_SCRIPT_PATH
data_load_cmd_tokens = ['sysbench',
prepare_script_path = sysbench05plus.PREPARE_SCRIPT_PATH
data_load_cmd_tokens = ['%s' % sysbench05plus.SYSBENCH05PLUS_PATH,
'--test=%s' % prepare_script_path,
'--mysql_svc_oltp_tables_count=%d' %
FLAGS.mysql_svc_oltp_tables_count,
Expand Down
54 changes: 19 additions & 35 deletions perfkitbenchmarker/linux_packages/sysbench05plus.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,18 @@
install 0.5 or later for them. Therefore, it's necessary that we have a
separate installer here for 0.5 and later.
"""
from perfkitbenchmarker import os_types
from perfkitbenchmarker.linux_packages import INSTALL_DIR

SYSBENCH05PLUS_PATH = '%s/bin/sysbench' % INSTALL_DIR
PREPARE_SCRIPT_PATH = ('%s/share/doc/sysbench/tests/db/parallel_prepare.lua'
% INSTALL_DIR)
OLTP_SCRIPT_PATH = '%s/share/doc/sysbench/tests/db/oltp.lua' % INSTALL_DIR

def PathPrefix(vm):
"""Determines the prefix for a sysbench command based on the operating system.

Args:
vm: VM on which the sysbench command will be executed.

Returns:
A string representing the sysbench command prefix.
"""
if vm.OS_TYPE == os_types.RHEL:
return INSTALL_DIR
else:
return '/usr/'


def YumInstall(vm):
""" Installs SysBench 0.5 for Rhel/CentOS. We have to build from source!"""
def _Install(vm):
"""Installs the SysBench 0.5 on the VM."""
vm.Install('build_tools')
vm.InstallPackages('bzr')
vm.InstallPackages('mysql mysql-server mysql-devel')
vm.RemoteCommand('cd ~ && bzr branch lp:sysbench')
vm.RemoteCommand(('cd ~/sysbench && ./autogen.sh &&'
' ./configure --prefix=%s --mandir=%s/share/man &&'
Expand All @@ -53,26 +41,22 @@ def YumInstall(vm):
INSTALL_DIR)
vm.RemoteCommand('sudo cp ~/sysbench/sysbench/tests/db/*'
' %s/share/doc/sysbench/tests/db/' % INSTALL_DIR)
vm.RemoteCommand('echo "export PATH=$PATH:%s/bin" >> ~/.bashrc && '
'source ~/.bashrc' % INSTALL_DIR)

# Cleanup the source code enlisthment from bzr, we don't need it anymore.
vm.RemoteCommand('cd ~ && rm -fr ./sysbench')

def YumInstall(vm):
""" Installs SysBench 0.5 for Rhel/CentOS. We have to build from source!"""
vm.InstallPackages('mysql mysql-server mysql-devel')
_Install(vm)


def AptInstall(vm):
""" Installs the sysbench 0.5 or later versions via APT Install """
vm.Install('wget')
vm.RemoteCommand('wget https://repo.percona.com/apt/'
'percona-release_0.1-4.$(lsb_release -sc)_all.deb')
vm.RemoteCommand(
'sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb')
vm.RemoteCommand('sudo apt-get update')
vm.InstallPackages('libc6')
vm.InstallPackages('mysql-client')
vm.InstallPackages('sysbench')
"""Installs the sysbench 0.5 on the VM."""
vm.RemoteCommand('sudo ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so '
'/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so')
vm.InstallPackages('mysql-client mysql-server libmysqlclient-dev')
_Install(vm)


def AptUninstall(vm):
vm.RemoteCommand('sudo dpkg --purge percona-release')
vm.RemoteCommand('sudo apt-get update')
def Uninstall(vm):
# Cleanup the source code enlisthment from bzr, we don't need it anymore.
vm.RemoteCommand('cd ~ && rm -fr ./sysbench')