Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Szalatnay committed Mar 15, 2017
1 parent 18e138c commit 1e94fae
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.rsa
*.pkg*
src
pkg
packages
159 changes: 159 additions & 0 deletions APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Contributor: Peter Szalatnay <theotherland@gmail.com>
# Maintainer: Peter Szalatnay <theotherland@gmail.com>
pkgname=percona-xtradb-cluster
_pkgname=Percona-XtraDB-Cluster
pkgver=5.7.16
_pkgver=5.7.16-27.19
pkgrel=0
pkgdesc="Percona XtraDB Cluster"
url="http://www.percona.com"
pkgusers="mysql"
pkggroups="mysql"
arch="all"
license="GPL2"
depends="$pkgname-common"
depends_dev="openssl-dev zlib-dev"
makedepends="cmake openssl-dev zlib-dev readline-dev libaio-dev ncurses-dev linux-headers bison bsd-compat-headers"
install="$pkgname.pre-install"
source="https://github.com/percona/percona-xtradb-cluster/archive/$_pkgname-$_pkgver.tar.gz
fix-posix_timers.patch
percona-xtradb-cluster.cnf
mysqld.cnf
mysqld_safe.cnf
client.cnf
wsrep.cnf
"

subpackages="$pkgname-doc $pkgname-dev $pkgname-common $pkgname-test:mytest
"

_builddir="$srcdir/$pkgname-$_pkgname-$_pkgver"
prepare() {
local i
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}

build() {
cd "$_builddir"

source "VERSION"
local MYSQL_VERSION="$MYSQL_VERSION_MAJOR.$MYSQL_VERSION_MINOR.$MYSQL_VERSION_PATCH"
local PERCONA_SERVER_EXTENSION="$(echo $MYSQL_VERSION_EXTRA | sed 's/^-/rel/')"

local WSREP_VERSION="$(grep WSREP_INTERFACE_VERSION wsrep/wsrep_api.h | cut -d '"' -f2).\
$(grep 'SET(WSREP_PATCH_VERSION' "cmake/wsrep.cmake" | cut -d '"' -f2)"

local COMMENT="Percona XtraDB Cluster binary (GPL) $MYSQL_VERSION-1$WSREP_VERSION"

local CFLAGS="-DPERCONA_INNODB_VERSION=$PERCONA_SERVER_EXTENSION -DSIGEV_THREAD_ID=4 -U_FORTIFY_SOURCE"
local CXXFLAGS="-DPERCONA_INNODB_VERSION=$PERCONA_SERVER_EXTENSION -U_FORTIFY_SOURCE"

cmake . -DBUILD_CONFIG=mysql_release \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DSYSCONFDIR=/etc/mysql \
-DWITH_EMBEDDED_SERVER=OFF \
-DFEATURE_SET=community \
-DENABLE_DTRACE=OFF \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DCMAKE_INSTALL_PREFIX=/usr \
-DMYSQL_DATADIR=/var/lib/mysql \
-DINSTALL_INFODIR=share/mysql/docs \
-DINSTALL_MANDIR=share/man \
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_DOCREADMEDIR=share/mysql \
-DINSTALL_SUPPORTFILESDIR=share/mysql \
-DINSTALL_MYSQLSHAREDIR=share/mysql \
-DINSTALL_DOCDIR=share/mysql/docs \
-DINSTALL_SHAREDIR=share/mysql \
-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_SERVER_SUFFIX="-$WSREP_VERSION" \
-DWITH_INNODB_DISALLOW_WRITES=ON \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST="$_builddir"/libboost \
-DWITH_WSREP=ON \
-DWITH_UNIT_TESTS=0 \
-DWITH_READLINE=system \
-DWITHOUT_TOKUDB=ON \
-DCOMPILATION_COMMENT="$COMMENT" \
-DWITH_PAM=OFF \
-DWITH_INNODB_MEMCACHED=ON \
-DWITH_SCALABILITY_METRICS=ON \
|| return 1

make || return 1
}

package() {
cd "$_builddir"
make DESTDIR="$pkgdir/" install || return 1

install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING || return 1

install -Dm 640 -o mysql "$srcdir"/percona-xtradb-cluster.cnf \
"$pkgdir"/etc/mysql/percona-xtradb-cluster.cnf

ln -s /etc/mysql/percona-xtradb-cluster.cnf \
"$pkgdir"/etc/mysql/my.cnf || return 1

mkdir -p "$pkgdir"/etc/mysql/conf.d/ || return 1

install -Dm 640 -o mysql "$srcdir"/client.cnf \
"$pkgdir"/etc/mysql/percona-xtradb-cluster.conf.d/client.cnf || return 1
install -Dm 640 -o mysql "$srcdir"/mysqld.cnf \
"$pkgdir"/etc/mysql/percona-xtradb-cluster.conf.d/mysqld.cnf || return 1
install -Dm 640 -o mysql "$srcdir"/mysqld_safe.cnf \
"$pkgdir"/etc/mysql/percona-xtradb-cluster.conf.d/mysqld_safe.cnf || return 1
install -Dm 640 -o mysql "$srcdir"/wsrep.cnf \
"$pkgdir"/etc/mysql/percona-xtradb-cluster.conf.d/wsrep.cnf || return 1

install -dDo mysql "$pkgdir"/var/log/mysql || return 1

# mysql-test includes one executable that doesn't belong under
# /usr/share, so move it and provide a symlink
mv "$pkgdir"/usr/mysql-test/lib/My/SafeProcess/my_safe_process \
"$pkgdir"/usr/bin
ln -s ../../../../bin/my_safe_process \
"$pkgdir"/usr/mysql-test/lib/My/SafeProcess/my_safe_process
}

doc() {
mkdir -p "$subpkgdir"/usr/share
mv "$pkgdir"/usr/man "$subpkgdir"/usr/share
default_doc
}

common() {
pkgdesc="Percona-XtraDB-Cluster common files for boh server and client"
replaces="mysql-common"
depends=
mkdir -p "$subpkgdir"/usr/share/mysql "$subpkgdir"/etc
mv "$pkgdir"/etc/mysql "$subpkgdir"/etc/ || return 1
local lang="charsets danish english french greek italian korean norwegian-ny
portuguese russian slovak swedish czech dutch estonian german
hungarian japanese norwegian polish romanian serbian spanish
ukrainian bulgarian"
for l in $lang; do
mv "$pkgdir"/usr/share/mysql/$l \
"$subpkgdir"/usr/share/mysql/ || return 1
done
}

mytest() {
pkgdesc="The test suite distributed with Percona-XtraDB-Cluster"
mkdir -p "$subpkgdir"/usr/bin || return 1
mv "$pkgdir"/usr/bin/mysql_client_test \
"$pkgdir"/usr/mysql-test \
"$pkgdir"/usr/bin/my_safe_process \
"$subpkgdir"/usr/bin/ \
|| return 1
}
3 changes: 3 additions & 0 deletions client.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[client]
port = 3306
socket = /run/mysqld/mysqld.sock
50 changes: 50 additions & 0 deletions fix-posix_timers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--- a/mysys/posix_timers.c
+++ b/mysys/posix_timers.c
@@ -188,10 +188,20 @@
On error, -1 is returned, and errno is set to indicate the error.
*/

+struct linux_sigevent {
+ union sigval sigev_value;
+ int sigev_signo;
+ int sigev_notify;
+ union {
+ int _pad[64-sizeof(int) * 2 + sizeof(union sigval)];
+ int _tid;
+ } _sigev_un;
+};
+
int
my_timer_create(my_timer_t *timer)
{
- struct sigevent sigev;
+ struct linux_sigevent sigev;

memset(&sigev, 0, sizeof(sigev));

@@ -200,7 +210,7 @@
sigev.sigev_notify= SIGEV_SIGNAL | SIGEV_THREAD_ID;
sigev.sigev_notify_thread_id= timer_notify_thread_id;

- return timer_create(CLOCK_MONOTONIC, &sigev, &timer->id);
+ return timer_create(CLOCK_MONOTONIC, (struct sigevent *)&sigev, &timer->id);
}
#elif defined(HAVE_SIGEV_PORT)
/**
@@ -311,7 +321,7 @@
int
my_timer_create(my_timer_t *timer)
{
- struct sigevent sigev;
+ struct linux_sigevent sigev;
port_notify_t port_notify;

port_notify.portnfy_port= port_id;
@@ -321,7 +331,7 @@
sigev.sigev_value.sival_ptr= &port_notify;
sigev.sigev_notify= SIGEV_PORT;

- return timer_create(CLOCK_REALTIME, &sigev, &timer->id);
+ return timer_create(CLOCK_MONOTONIC, (struct sigevent *)&sigev, &timer->id);
}
#endif
16 changes: 16 additions & 0 deletions mysqld.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Template my.cnf for PXC
# Edit to your requirements.
[mysqld]
server-id=1
datadir=/var/lib/mysql
socket=/run/mysqld/mysqld.sock
log-error=/var/log/mysqld.log
pid-file=/run/mysqld/mysqld.pid
log-bin
log_slave_updates
expire_logs_days=7

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
bind-address = 127.0.0.1
local-infile = 0
14 changes: 14 additions & 0 deletions mysqld_safe.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# The Percona XtraDB Cluster 5.7 configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld_safe]
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock
nice = 0
11 changes: 11 additions & 0 deletions percona-xtradb-cluster.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# The Percona XtraDB Cluster 5.7 configuration file.
#
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
# Please make any edits and changes to the appropriate sectional files
# included below.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/percona-xtradb-cluster.conf.d/
5 changes: 5 additions & 0 deletions percona-xtradb-cluster.pre-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

addgroup -S mysql 2>/dev/null
adduser -h /var/lib/mysql -s /sbin/nologin -G mysql -D mysql 2>/dev/null
exit 0
39 changes: 39 additions & 0 deletions wsrep.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[mysqld]
# Path to Galera library
wsrep_provider=/usr/lib/galera3/libgalera_smm.so

# Cluster connection URL contains IPs of nodes
#If no IP is found, this implies that a new cluster needs to be created,
#in order to do that you need to bootstrap this node
wsrep_cluster_address=gcomm://

# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW

# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB

# Slave thread to use
wsrep_slave_threads= 8

wsrep_log_conflicts

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2

# Node IP address
#wsrep_node_address=192.168.70.63
# Cluster name
wsrep_cluster_name=pxc-cluster

#If wsrep_node_name is not specified, then system hostname will be used
wsrep_node_name=pxc-cluster-node-1

#pxc_strict_mode allowed values: DISABLED,PERMISSIVE,ENFORCING,MASTER
pxc_strict_mode=ENFORCING

# SST method
wsrep_sst_method=xtrabackup-v2

#Authentication for SST method
#wsrep_sst_auth="sstuser:s3cretPass"

0 comments on commit 1e94fae

Please sign in to comment.