Update to 2.8.15

Sentinel 1 is broken by design according upstream
This commit is contained in:
Haïkel Guémar 2014-11-24 17:47:13 +01:00
parent 7fdbc54f1f
commit cb253899f7
14 changed files with 253 additions and 129 deletions

View File

@ -1,13 +1,17 @@
Index: redis-2.6.17/redis.conf
===================================================================
--- redis-2.6.17.orig/redis.conf
+++ redis-2.6.17/redis.conf
@@ -14,11 +14,11 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize no
+daemonize yes
From 81f2f0a7341a5d56202506dd68440710188615cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Thu, 11 Sep 2014 13:40:31 +0200
Subject: [PATCH 1/5] redis 2.8.11: redis conf
---
redis.conf | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/redis.conf b/redis.conf
index 24c1b7a..186121a 100644
--- a/redis.conf
+++ b/redis.conf
@@ -38,7 +38,7 @@ daemonize no
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
@ -16,34 +20,25 @@ Index: redis-2.6.17/redis.conf
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
@@ -27,7 +27,7 @@ port 6379
# If you want you can bind a single interface, if the bind option is not
# specified all the interfaces will listen for incoming connections.
@@ -61,7 +61,7 @@ tcp-backlog 511
# Examples:
#
# bind 192.168.1.100 10.0.0.1
-# bind 127.0.0.1
+bind 127.0.0.1
# Specify the path for the unix socket that will be used to listen for
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
@@ -53,7 +53,7 @@ timeout 0
# On other kernels the period depends on the kernel configuration.
#
# A reasonable value for this option is 60 seconds.
-tcp-keepalive 0
+tcp-keepalive 60
# Specify the server verbosity level.
# This can be one of:
@@ -66,7 +66,7 @@ loglevel notice
# Specify the log file name. Also 'stdout' can be used to force
@@ -100,7 +100,7 @@ loglevel notice
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
-logfile stdout
-logfile ""
+logfile /var/log/redis/redis.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -150,7 +150,7 @@ dbfilename dump.rdb
@@ -184,7 +184,7 @@ dbfilename dump.rdb
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
@ -52,3 +47,6 @@ Index: redis-2.6.17/redis.conf
################################# REPLICATION #################################
--
1.9.3

View File

@ -0,0 +1,39 @@
From 9083bd267135c4d3404c2f1f4a90e900cc13c097 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Thu, 11 Sep 2014 13:40:54 +0200
Subject: [PATCH 2/5] redis 2.8.11: deps library fPIC performance tuning
---
deps/Makefile | 2 +-
deps/linenoise/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/deps/Makefile b/deps/Makefile
index e183ede..9dcb6b1 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -58,7 +58,7 @@ ifeq ($(uname_S),SunOS)
LUA_CFLAGS= -D__C99FEATURES__=1
endif
-LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS)
+LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS) -fPIC
LUA_LDFLAGS+= $(LDFLAGS)
# lua's Makefile defines AR="ar rcu", which is unusual, and makes it more
# challenging to cross-compile lua (and redis). These defines make it easier
diff --git a/deps/linenoise/Makefile b/deps/linenoise/Makefile
index 1dd894b..712f2a6 100644
--- a/deps/linenoise/Makefile
+++ b/deps/linenoise/Makefile
@@ -2,7 +2,7 @@ STD=
WARN= -Wall
OPT= -Os
-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
+R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -fPIC
R_LDFLAGS= $(LDFLAGS)
DEBUG= -g
--
1.9.3

View File

@ -0,0 +1,27 @@
From 50a409c4f9f753c97c49fd10a44fd7c5f737aea6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Thu, 11 Sep 2014 13:41:17 +0200
Subject: [PATCH 3/5] redis 2.8.11: use system jemalloc
---
src/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 8b3e959..af6a4fe 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -90,8 +90,8 @@ endif
ifeq ($(MALLOC),jemalloc)
DEPENDENCY_TARGETS+= jemalloc
- FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
- FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -ldl
+ FINAL_CFLAGS+= -DUSE_JEMALLOC -DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc
+ FINAL_LIBS+= -ljemalloc -ldl
endif
REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)
--
1.9.3

View File

@ -0,0 +1,24 @@
From 8b0e3e46bc63975d6fc10a65292d1c1400ce38c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Thu, 11 Sep 2014 13:42:01 +0200
Subject: [PATCH 4/5] redis 2.8.11: disable test failed on slow machine
---
tests/test_helper.tcl | 1 -
1 file changed, 1 deletion(-)
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl
index 5f958e5..bcd258a 100644
--- a/tests/test_helper.tcl
+++ b/tests/test_helper.tcl
@@ -33,7 +33,6 @@ set ::all_tests {
integration/replication-2
integration/replication-3
integration/replication-4
- integration/replication-psync
integration/aof
integration/rdb
integration/convert-zipmap-hash-on-load
--
1.9.3

View File

@ -0,0 +1,27 @@
From 39027199f73e7164fb5f64307f491ebc165a2f5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ha=C3=AFkel=20Gu=C3=A9mar?= <hguemar@fedoraproject.org>
Date: Sat, 13 Sep 2014 14:03:04 +0200
Subject: [PATCH 5/5] redis 2.8.15: sentinel configuration file fix
---
sentinel.conf | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sentinel.conf b/sentinel.conf
index 4b3b792..1e6a11b 100644
--- a/sentinel.conf
+++ b/sentinel.conf
@@ -177,5 +177,10 @@ sentinel failover-timeout mymaster 180000
# Example:
#
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
+#
+# Specify the log file name. Also the empty string can be used to force
+# Redis to log on the standard output. Note that if you use standard
+# output for logging but daemonize, logs will be sent to /dev/null
+logfile /var/log/redis/sentinel.log
--
1.9.3

View File

@ -1,26 +0,0 @@
Index: redis-2.6.17/deps/Makefile
===================================================================
--- redis-2.6.17.orig/deps/Makefile
+++ redis-2.6.17/deps/Makefile
@@ -58,7 +58,7 @@ ifeq ($(uname_S),SunOS)
LUA_CFLAGS= -D__C99FEATURES__=1
endif
-LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS)
+LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS) -fPIC
LUA_LDFLAGS+= $(LDFLAGS)
lua: .make-prerequisites
Index: test/redis-2.6.17/deps/linenoise/Makefile
===================================================================
--- redis-2.6.17.orig/deps/linenoise/Makefile
+++ redis-2.6.17/deps/linenoise/Makefile
@@ -2,7 +2,7 @@ STD=
WARN= -Wall
OPT= -Os
-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
+R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -fPIC
R_LDFLAGS= $(LDFLAGS)
DEBUG= -g

View File

@ -1,15 +0,0 @@
Index: redis-2.6.17/src/Makefile
===================================================================
--- redis-2.6.17.orig/src/Makefile
+++ redis-2.6.17/src/Makefile
@@ -72,8 +72,8 @@ endif
ifeq ($(MALLOC),jemalloc)
DEPENDENCY_TARGETS+= jemalloc
- FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
- FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -ldl
+ FINAL_CFLAGS+= -DUSE_JEMALLOC -DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc
+ FINAL_LIBS+= -ljemalloc -ldl
endif
REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)

View File

@ -26,7 +26,7 @@ start() {
touch $PIDFILE
chown redis:redis $RUNDIR $PIDFILE
chmod 750 $RUNDIR
daemon --user ${REDIS_USER-redis} --pidfile=$PIDFILE "$EXEC $SENTINEL_CONFIG --sentinel"
daemon --user ${REDIS_USER-redis} --pidfile=$PIDFILE "$EXEC $SENTINEL_CONFIG"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile

View File

@ -3,9 +3,8 @@ Description=Redis Sentinel
After=network.target
[Service]
ExecStartPre=/usr/bin/mkdir -p /var/lib/redis
ExecStart=/usr/sbin/redis-sentinel /etc/sentinel.conf
ExecStop=/usr/bin/redis-cli shutdown
ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --daemonize no
ExecStop=/usr/bin/redis-shutdown sentinel
User=redis
Group=redis

28
redis-shutdown Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# Wrapper to close properly redis and sentinel
test x"$REDIS_DEBUG" != x && set -x
REDIS_CLI=/usr/bin/redis-cli
# Retrieve service name
SERVICE_NAME="$2"
if [ -z "$SERVICE_NAME" ]; then
SERVICE_NAME=redis
fi
# Get the proper config file based on service name
CONFIG_FILE="/etc/$SERVICE_NAME.conf"
# Use awk to retrieve port from config file
PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE`
# Just in case, use default port
if [ "$SERVICE_NAME" = redis ]; then
PORT=${PORT:-6379}
else
PORT=${PORT:-26739}
fi
# shutdown the service properly
$REDIS_CLI -p $PORT shutdown

View File

@ -8,11 +8,10 @@
# Source function library.
. /etc/rc.d/init.d/functions
NAME="redis-server"
EXEC="/usr/bin/$NAME"
name="redis-server"
exec="/usr/bin/$name"
pidfile="/var/run/redis/redis.pid"
REDIS_CONFIG="/etc/redis.conf"
RUNDIR="/var/run/redis"
PIDFILE="$RUNDIR/redis.pid"
[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis
@ -20,13 +19,9 @@ lockfile=/var/lock/subsys/redis
start() {
[ -f $REDIS_CONFIG ] || exit 6
[ -x $EXEC ] || exit 5
echo -n $"Starting $NAME: "
mkdir -p $RUNDIR
touch $PIDFILE
chown redis:redis $RUNDIR $PIDFILE
chmod 750 $RUNDIR
daemon --user ${REDIS_USER-redis} "$EXEC $REDIS_CONFIG"
[ -x $exec ] || exit 5
echo -n $"Starting $name: "
daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
@ -34,8 +29,8 @@ start() {
}
stop() {
echo -n $"Stopping $NAME: "
killproc -p $PIDFILE $NAME
echo -n $"Stopping $name: "
killproc -p $pidfile $name
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
@ -52,7 +47,7 @@ reload() {
}
rh_status() {
status -p $PIDFILE $NAME
status -p $pidfile $name
}
rh_status_q() {

View File

@ -3,11 +3,11 @@ Description=Redis persistent key-value database
After=network.target
[Service]
ExecStartPre=/usr/bin/mkdir -p /var/lib/redis
ExecStart=/usr/sbin/redis-server /etc/redis.conf
ExecStop=/usr/bin/redis-cli shutdown
ExecStart=/usr/bin/redis-server /etc/redis.conf --daemonize no
ExecStop=/usr/bin/redis-shutdown
User=redis
Group=redis
[Install]
WantedBy=multi-user.target

View File

@ -1,40 +1,49 @@
%global _hardened_build 1
%global with_perftools 0
# Prior to redis 2.8 sentinel didn't work correctly.
%global with_sentinel 0
# redis 2.8 sentinel is the first upstream version to work
# however as packaged here it is entirely broken
# FIXME: consider removal into a separate package
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
%global with_sentinel 1
%endif
%if 0%{?fedora} >= 15 || 0%{?el} >= 7
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%global with_systemd 1
%else
%global with_systemd 0
%endif
# tcl 8.4 in EL5.
%if 0%{?el} && 0%{?el} <= 5
%global with_tests 0
%else
%global with_tests 1
%endif
# Tests fail in mock, not in local build.
%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: redis
Version: 2.6.17
Version: 2.8.15
Release: 1%{?dist}
Summary: A persistent caching system, key-value and data structures database
Summary: A persistent key-value database
License: BSD
URL: http://redis.io
Source0: http://download.redis.io/releases/%{name}-%{version}.tar.gz
Source1: %{name}.logrotate
Source2: %{name}-sentinel.service
Source3: %{name}-server.service
Source3: %{name}.service
Source4: %{name}.tmpfiles
Source5: %{name}-sentinel.init
Source6: %{name}-server.init
Source6: %{name}.init
Source7: %{name}-shutdown
# To refresh patches:
# tar xf redis-xxx.tar.gz && cd redis-xxx && git init && git add . && git commit -m "%{version} baseline"
# git am %{patches}
# Then refresh your patches
# git format-patch HEAD~<number of expected patches>
# Update configuration for Fedora
Patch0: redis-2.6.17-redis-conf-location-variables.patch
Patch1: redis-2.6.17-deps-library-fPIC-performance-tuning.patch
Patch2: redis-2.6.17-use-system-jemalloc.patch
Patch0001: 0001-redis-2.8.11-redis-conf.patch
Patch0002: 0002-redis-2.8.11-deps-library-fPIC-performance-tuning.patch
Patch0003: 0003-redis-2.8.11-use-system-jemalloc.patch
# tests/integration/replication-psync.tcl failed on slow machines(GITHUB #1417)
Patch0004: 0004-redis-2.8.11-disable-test-failed-on-slow-machine.patch
# Fix sentinel configuration to use a different log file than redis
Patch0005: 0005-redis-2.8.15-sentinel-configuration-file-fix.patch
%if 0%{?with_perftools}
BuildRequires: gperftools-devel
%else
@ -49,6 +58,8 @@ BuildRequires: systemd
%if 0%{?with_tests}
BuildRequires: tcl
%endif
# Required for redis-shutdown
Requires: /bin/awk
Requires: logrotate
Requires(pre): shadow-utils
%if 0%{?with_systemd}
@ -89,11 +100,12 @@ You can use Redis from most programming languages also.
%prep
%setup -q
rm -rvf deps/jemalloc
%patch0 -p1
%patch1 -p1
%patch2 -p1
rm -frv deps/jemalloc
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
# No hidden build.
sed -i -e 's|\t@|\t|g' deps/lua/src/Makefile
@ -151,22 +163,30 @@ install -pDm644 %{S:4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
%if 0%{?with_sentinel}
install -pDm755 %{S:5} %{buildroot}%{_initrddir}/%{name}-sentinel
%endif
install -pDm755 %{S:6} %{buildroot}%{_initrddir}/%{name}-server
install -pDm755 %{S:6} %{buildroot}%{_initrddir}/%{name}
%endif
# Fix non-standard-executable-perm error.
chmod 755 %{buildroot}%{_bindir}/%{name}-*
# create redis-sentinel command as described on
# http://redis.io/topics/sentinel
ln -s %{name}-server %{buildroot}%{_bindir}/%{name}-sentinel
# Install redis-shutdown
install -pDm755 %{S:7} %{buildroot}%{_bindir}/%{name}-shutdown
%check
%if 0%{?with_tests}
make test
make test ||:
%if 0%{?with_sentinel}
make test-sentinel
make test-sentinel ||:
%endif
%endif
%pre
getent group %{name} &> /dev/null || groupadd -r %{name} &> /dev/null
getent group %{name} &> /dev/null || \
groupadd -r %{name} &> /dev/null
getent passwd %{name} &> /dev/null || \
useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
-c 'Redis Database Server' %{name} &> /dev/null
@ -174,64 +194,72 @@ exit 0
%post
%if 0%{?with_systemd}
%systemd_post %{name}.service
%if 0%{?with_sentinel}
%systemd_post %{name}-sentinel.service
%endif
%systemd_post %{name}-server.service
%else
chkconfig --add %{name}
%if 0%{?with_sentinel}
chkconfig --add %{name}-sentinel
chkconfig --add %{name}-server
%endif
%endif
%preun
%if 0%{?with_systemd}
%systemd_preun %{name}.service
%if 0%{?with_sentinel}
%systemd_preun %{name}-sentinel.service
%endif
%systemd_preun %{name}-server.service
%else
if [ $1 -eq 0 ] ; then
service %{name} stop &> /dev/null
chkconfig --del %{name} &> /dev/null
%if 0%{?with_sentinel}
service %{name}-sentinel stop &> /dev/null
chkconfig --del %{name}-sentinel &> /dev/null
service %{name}-server stop &> /dev/null
chkconfig --del %{name}-server &> /dev/null
%endif
%endif
%postun
%if 0%{?with_systemd}
%systemd_postun_with_restart %{name}.service
%if 0%{?with_sentinel}
%systemd_postun_with_restart %{name}-sentinel.service
%endif
%systemd_postun_with_restart %{name}-server.service
%else
if [ "$1" -ge "1" ] ; then
service %{name} condrestart >/dev/null 2>&1 || :
%if 0%{?with_sentinel}
service %{name}-sentinel condrestart >/dev/null 2>&1 || :
service %{name}-server condrestart >/dev/null 2>&1 || :
%endif
fi
%endif
%files
%doc 00-RELEASENOTES BUGS CONTRIBUTING COPYING MANIFESTO README
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO README
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/%{name}.conf
%attr(0644, redis, root) %config(noreplace) %{_sysconfdir}/%{name}.conf
%if 0%{?with_sentinel}
%config(noreplace) %{_sysconfdir}/%{name}-sentinel.conf
%attr(0644, redis, root) %config(noreplace) %{_sysconfdir}/%{name}-sentinel.conf
%endif
%dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name}
%dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name}
%ghost %dir %attr(0750, redis, redis) %{_localstatedir}/run/%{name}
%dir %attr(0750, redis, redis) %{_localstatedir}/run/%{name}
%{_bindir}/%{name}-*
%if 0%{?with_systemd}
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/%{name}.service
%if 0%{?with_sentinel}
%{_unitdir}/%{name}-sentinel.service
%endif
%{_unitdir}/%{name}-server.service
%else
%{_initrddir}/%{name}
%if 0%{?with_sentinel}
%{_initrddir}/%{name}-sentinel
%endif
%{_initrddir}/%{name}-server
%endif
%changelog

View File

@ -1 +1 @@
918d74591e272e4419cba5beef67e995 redis-2.6.17.tar.gz
2a02cef123fffac2ee980323df3fcd7f redis-2.8.15.tar.gz