Skip to content

Commit

Permalink
memcached: upgrade 1.6.9 + DSM7 support (#4522)
Browse files Browse the repository at this point in the history
* memcached: bump 1.4.13 -> 1.6.9
+ reworked to use standard "framework"
* Add DSM 7 support logics
* Fixed invalid no-arch switch
* Added missing CONF_DIR parameter
* Fixed setup to handle configuration file
* Improve upgrade procedure
* Cleanup unnecessary code
* Fix upgrade procedure attempt #2
* Cleanup of enforced compilation parameters
* Attemptive fix at configuration files
* Fixing backup process
* Fixed invalid WEB_DIR environment variable
* Replace the default configuration file by a file provided upon package generation
* Fixed restoration to be performed
* Prefer using tar command to perform backups
* Simplified web directory computing + fixed sc-memcecahed to be part of the http group
* Remove verbosity on tar extraction commands
* Added explicit service port informations
* Fixed resource to include service port configuration
* memcached: rework
- update memcached to v1.6.15
- aarch64 patch is not required (memcached/memcached#743 is not an issue)
- update phpMemcachedAdmin to include fix for 1.6.x
- fix service user
* memcached: rework (2)
- use custom app/config file to link with phpMemcachdAdmin
- update icon
- set owner of config file on DSM < 7
* minor cleanup
- update license
- remove autoconf as configure script is included
* activate DSM 7 webservice icon
- avoid default DSM UI icon on DSM 7
* add diyspk/memaslap to test and benchmark memcached server
- add cross/libmemcached
- enable build of memaslap
- fix build for DSM 7 (issue with newer compilers)
- add patches for correct program name and faster build
* memcachd: optimize code
- use code optimization
- fix build for OLD_PPC_ARCHS
* fix phpmemcachedadmin configuration
- update phpmemcachedadmin to store config in var folder and link as Config into web folder
- fix folder permissions for phpmemcachedadmin
- create Memcache.php on demand

* framework: enhanced for custom app/config file
- add Makefile variable DSM_UI_CONFIG for package specific app/config files

* update generic installers
- remove SYNOPKG_DSM_VERSION_MAJOR check in installers
- use GROUP variable for group in set_unix_permissions for DSM 6

Co-authored-by: hgy59 <[email protected]>
  • Loading branch information
smaarn and hgy59 authored Jun 4, 2022
1 parent 4285c83 commit 5ce6622
Show file tree
Hide file tree
Showing 24 changed files with 359 additions and 297 deletions.
21 changes: 21 additions & 0 deletions cross/libmemcached/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PKG_NAME = libmemcached
PKG_VERS = 1.0.18
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://launchpad.net/libmemcached/1.0/$(PKG_VERS)/+download
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/libevent

HOMEPAGE = https://libmemcached.org/libMemcached.html
COMMENT = libMemcached is an open source C/C++ client library and tools for the memcached server.
LICENSE = 3-Clause BSD

GNU_CONFIGURE = 1
CONFIGURE_ARGS = --disable-static
CONFIGURE_ARGS += --enable-memaslap
CONFIGURE_ARGS += ax_cv_gcc_atomic_builtins=yes
# https://medium.com/swlh/the-complete-guide-to-benchmark-the-performance-of-memcached-on-ubuntu-16-04-71edeaf6e740
CONFIGURE_ARGS += ax_cv_libevent=yes

include ../../mk/spksrc.cross-cc.mk
23 changes: 23 additions & 0 deletions cross/libmemcached/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
bin:bin/memaslap
bin:bin/memcapable
bin:bin/memcat
bin:bin/memcp
bin:bin/memdump
bin:bin/memerror
bin:bin/memexist
bin:bin/memflush
bin:bin/memparse
bin:bin/memping
bin:bin/memrm
bin:bin/memslap
bin:bin/memstat
bin:bin/memtouch
lnk:lib/libhashkit.so
lnk:lib/libhashkit.so.2
lib:lib/libhashkit.so.2.0.0
lnk:lib/libmemcached.so
lnk:lib/libmemcached.so.11
lib:lib/libmemcached.so.11.0.0
lnk:lib/libmemcachedutil.so
lnk:lib/libmemcachedutil.so.2
lib:lib/libmemcachedutil.so.2.0.0
3 changes: 3 additions & 0 deletions cross/libmemcached/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
libmemcached-1.0.18.tar.gz SHA1 8be06b5b95adbc0a7cb0f232e237b648caf783e1
libmemcached-1.0.18.tar.gz SHA256 e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82
libmemcached-1.0.18.tar.gz MD5 b3958716b4e53ddc5992e6c49d97e819
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# avoid comparison of pointer with integer
# error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
#
--- clients/memflush.cc.orig 2014-02-09 12:52:42.000000000 +0100
+++ clients/memflush.cc 2022-06-03 10:06:40.989938212 +0200
@@ -39,7 +39,7 @@
{
options_parse(argc, argv);

- if (opt_servers == false)
+ if (opt_servers == NULL)
{
char *temp;

@@ -48,7 +48,7 @@
opt_servers= strdup(temp);
}

- if (opt_servers == false)
+ if (opt_servers == NULL)
{
std::cerr << "No Servers provided" << std::endl;
exit(EXIT_FAILURE);
15 changes: 15 additions & 0 deletions cross/libmemcached/patches/002-avoid-build-of-test-programs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# For faster build:
# - remove target with test programs (noinst_PROGRAMS) in generated Makefile.
# PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
#
--- Makefile.in.orig 2014-02-09 11:52:56.000000000 +0000
+++ Makefile.in 2022-06-03 08:39:02.989627735 +0000
@@ -9961,7 +9961,7 @@
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \
+all-am: Makefile $(LTLIBRARIES) $(bin_PROGRAMS) $(MANS) $(DATA) $(HEADERS) \
mem_config.h
install-binPROGRAMS: install-libLTLIBRARIES

100 changes: 100 additions & 0 deletions cross/libmemcached/patches/003-adjust-programname-of-memaslap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Adjust the program name to be able to identify the tool as memaslap
#
# memslap is another tool of libmemcached, that is not as useful
# as it does not show stats nor accepts parameters such as threads or time.
#
--- clients/memaslap.c.orig 2014-02-09 11:52:42.000000000 +0000
+++ clients/memaslap.c 2022-06-03 09:57:33.085672134 +0000
@@ -1,5 +1,5 @@
/*
- * memslap
+ * memaslap
*
* (c) Copyright 2009, Schooner Information Technology, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
#include "ms_setting.h"
#include "ms_thread.h"

-#define PROGRAM_NAME "memslap"
+#define PROGRAM_NAME "memaslap"
#define PROGRAM_DESCRIPTION \
"Generates workload against memcached servers."

@@ -111,7 +111,7 @@
static void ms_statistic_init(void);
static void ms_stats_init(void);
static void ms_print_statistics(int in_time);
-static void ms_print_memslap_stats(struct timeval *start_time,
+static void ms_print_memaslap_stats(struct timeval *start_time,
struct timeval *end_time);
static void ms_monitor_slap_mode(void);

@@ -130,7 +130,7 @@
printf(" %s\n\n", description);
printf(
"Usage:\n"
- " memslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]\n\n"
+ " memaslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]\n\n"
"Options:\n");

for (int x= 0; long_options[x].name; x++)
@@ -146,13 +146,13 @@

printf(
"\nExamples:\n"
- " memslap -s 127.0.0.1:11211 -S 5s\n"
- " memslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b\n"
- " memslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2\n"
- " memslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k\n"
- " memslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40\n"
- " memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m\n"
- " memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2\n\n");
+ " memaslap -s 127.0.0.1:11211 -S 5s\n"
+ " memaslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b\n"
+ " memaslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2\n"
+ " memaslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k\n"
+ " memaslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40\n"
+ " memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m\n"
+ " memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2\n\n");

exit(0);
} /* ms_help_command */
@@ -286,7 +286,7 @@

case OPT_UDP:
return
- "UDP support, default memslap uses TCP, TCP port and UDP port of\n"
+ "UDP support, default memaslap uses TCP, TCP port and UDP port of\n"
" server must be same.";

case OPT_EXPIRE:
@@ -708,8 +708,8 @@
} /* ms_print_statistics */


-/* used to print the states of memslap */
-static void ms_print_memslap_stats(struct timeval *start_time,
+/* used to print the states of memaslap */
+static void ms_print_memaslap_stats(struct timeval *start_time,
struct timeval *end_time)
{
char buf[1024];
@@ -803,7 +803,7 @@

fprintf(stdout, "%s", buf);
fflush(stdout);
-} /* ms_print_memslap_stats */
+} /* ms_print_memaslap_stats */


/* the loop of the main thread, wait the work threads to complete */
@@ -883,7 +883,7 @@
gettimeofday(&end_time, NULL);
}

- ms_print_memslap_stats(&start_time, &end_time);
+ ms_print_memaslap_stats(&start_time, &end_time);
} /* ms_monitor_slap_mode */


18 changes: 10 additions & 8 deletions cross/memcached/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = memcached
PKG_VERS = 1.4.15
PKG_VERS = 1.6.15
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://www.memcached.org/files
Expand All @@ -9,14 +9,16 @@ DEPENDS = cross/libevent

HOMEPAGE = https://www.memcached.org/
COMMENT = Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
LICENSE = BSD
LICENSE = 3-Clause BSD

PRE_CONFIGURE_TARGET = memcached_pre_configure
CONFIGURE_ARGS = ac_cv_c_endian=little
GNU_CONFIGURE = 1
ADDITIONAL_CFLAGS = -O

include ../../mk/spksrc.cross-cc.mk
include ../../mk/spksrc.archs.mk
ifeq ($(findstring $(ARCH),$(OLD_PPC_ARCHS)),$(ARCH))
# EFD_NONBLOCK is not defined (define it OR disable use of eventfd)
#ADDITIONAL_CFLAGS += -DEFD_NONBLOCK=0x0004000
CONFIGURE_ARGS = ac_cv_func_eventfd=no
endif

.PHONY: memcached_pre_configure
memcached_pre_configure:
@$(RUN) autoconf
include ../../mk/spksrc.cross-cc.mk
6 changes: 3 additions & 3 deletions cross/memcached/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
memcached-1.4.15.tar.gz SHA1 12ec84011f408846250a462ab9e8e967a2e8cbbc
memcached-1.4.15.tar.gz SHA256 169721ab7a7531add6ae9f6b14b6b5641725fe0b1f0bdf5c3a4327725901e2b4
memcached-1.4.15.tar.gz MD5 36ea966f5a29655be1746bf4949f7f69
memcached-1.6.15.tar.gz SHA1 badcfa0d65f5797cc9c2f957f3fbfedbd8c13411
memcached-1.6.15.tar.gz SHA256 8d7abe3d649378edbba16f42ef1d66ca3f2ac075f2eb97145ce164388e6ed515
memcached-1.6.15.tar.gz MD5 8a21ef7bc1c427e6cd88cac270394898
10 changes: 5 additions & 5 deletions cross/memcached/patches/001-remove-werror.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
--- configure.ac.orig 2012-09-03 09:35:54.000000000 +0200
+++ configure.ac 2012-12-08 00:31:35.000000000 +0100
@@ -534,12 +534,12 @@
@@ -788,12 +788,12 @@
if test "$ICC" = "yes"
then
dnl ICC trying to be gcc.
- CFLAGS="$CFLAGS -diag-disable 187 -Wall -Werror"
+ CFLAGS="$CFLAGS -diag-disable 187 -Wall"
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
AC_DEFINE([_GNU_SOURCE],[1],[make sure IOV_MAX is defined])
elif test "$GCC" = "yes"
then
GCC_VERSION=`$CC -dumpversion`
- CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
+ CFLAGS="$CFLAGS -Wall -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
case $GCC_VERSION in
4.4.*)
CFLAGS="$CFLAGS -fno-strict-aliasing"
if test "x$enable_asan" = "xyes"; then
CFLAGS="$CFLAGS -fsanitize=address"
fi
35 changes: 23 additions & 12 deletions cross/phpmemcachedadmin/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
PKG_NAME = phpMemcachedAdmin
PKG_VERS = 1.2.2-r262
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/phpmemcacheadmin
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)
PKG_DOWNLOAD_METHOD = git
PKG_GIT_HASH = aaf3d16a2a1e3dff72dd358f1758d96f0f174cb3
PKG_DIST_SITE = https://github.com/elijaa/phpmemcachedadmin.git
PKG_DIST_FILE = $(PKG_NAME)-git$(PKG_GIT_HASH).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-git$(PKG_GIT_HASH)

# Unfortunately only version 1.3.0 is officially released, but
# we need the commit aaf3d16 of 12 Jun 2020 for memcached 1.6.x
# Issue #19: fix mem_requested key change in Memcached 1.5.17

DEPENDS =

HOMEPAGE = https://github.com/elijaa/phpmemcachedadmin
COMMENT = Graphic stand-alone administration for memcached to monitor and debug purpose
LICENSE = Apache License 2.0
COMMENT = Graphic stand-alone administration for memcached to monitor and debug purpose.
LICENSE = Apache 2.0

EXTRACT_PATH = $(WORK_DIR)/$(PKG_DIR)
CONFIGURE_TARGET = nop
COMPILE_TARGET = nop
EXTRACT_PATH = $(WORK_DIR)
INSTALL_TARGET = phpmemcachedadmin_install

include ../../mk/spksrc.cross-cc.mk
include ../../mk/spksrc.install-resources.mk

CONFIG_FOLDER = $(STAGING_INSTALL_PREFIX)/var/phpmemcachedadmin.config

.PHONY: phpmemcachedadmin_install
# link the Config folder into var for backup/restore on package update
# and for on demand creation of the default config on DSM 7.
phpmemcachedadmin_install:
mkdir -p $(STAGING_INSTALL_PREFIX)/share/phpMemcachedAdmin
tar -cf - -C $(WORK_DIR)/$(PKG_DIR) . | tar -xf - -C $(STAGING_INSTALL_PREFIX)/share/phpMemcachedAdmin
@mkdir -p $(STAGING_INSTALL_PREFIX)/share/$(PKG_NAME)
@tar -cf - -C $(WORK_DIR)/$(PKG_DIR) --exclude Config . | tar -xf - -C $(STAGING_INSTALL_PREFIX)/share/$(PKG_NAME)
@echo folder=$(CONFIG_FOLDER)
@install -d -m 755 $(CONFIG_FOLDER)
@install -m 755 $(WORK_DIR)/$(PKG_DIR)/Config/* $(CONFIG_FOLDER)/
@cd $(STAGING_INSTALL_PREFIX)/share/$(PKG_NAME) && ln -sf $(INSTALL_PREFIX_VAR)/phpmemcachedadmin.config Config
3 changes: 2 additions & 1 deletion cross/phpmemcachedadmin/PLIST
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rsc:share/phpMemcachedAdmin
rsc:share/phpMemcachedAdmin/
rsc:var/phpmemcachedadmin.config/
6 changes: 3 additions & 3 deletions cross/phpmemcachedadmin/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
phpMemcachedAdmin-1.2.2-r262.tar.gz SHA1 616d33deeb54c7bb0b894b23589afc81aa3f67f5
phpMemcachedAdmin-1.2.2-r262.tar.gz SHA256 10022211593c78b4eaaec16054843979f0b98ed72e86ee93e4fe79bf35c383e3
phpMemcachedAdmin-1.2.2-r262.tar.gz MD5 93ce23bc02f8f262d55d749d40058388
phpMemcachedAdmin-gitaaf3d16a2a1e3dff72dd358f1758d96f0f174cb3.tar.gz SHA1 28d8c233e6e1814fd25a37a2c1f7d3ee35a94d32
phpMemcachedAdmin-gitaaf3d16a2a1e3dff72dd358f1758d96f0f174cb3.tar.gz SHA256 1248fe1c6df610b6ea69dfba1a2774d182160a444759d3bf1b4782458d40fe00
phpMemcachedAdmin-gitaaf3d16a2a1e3dff72dd358f1758d96f0f174cb3.tar.gz MD5 e1e846983f33fcdb480c91c365bc7cac
16 changes: 16 additions & 0 deletions diyspk/memaslap/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SPK_NAME = memaslap
SPK_VERS = 1.0
SPK_REV = 1

DEPENDS = cross/libmemcached

MAINTAINER = SynoCommunity
DESCRIPTION = memaslap is a load generation and benchmark tool for memcached servers. It generates configurable workload such as threads, concurrencies, connections, run time, overwrite, miss rate, key size, value size, get/set proportion, expected throughput, and so on.
STARTABLE = no

HOMEPAGE = http://docs.libmemcached.org/bin/memaslap.html
LICENSE = 3-Clause BSD

SPK_COMMANDS = bin/memaslap

include ../../mk/spksrc.spk.mk
24 changes: 9 additions & 15 deletions mk/spksrc.service.installer.dsm5
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,7 @@ set_unix_permissions ()
DIRNAME=$1
if [ -n "${EFF_USER}" ]; then
echo "Granting '${EFF_USER}' unix ownership on ${DIRNAME}"
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then
chown -R ${EFF_USER}:root "${DIRNAME}"
else
chown -R ${EFF_USER}:${USER} "${DIRNAME}"
fi
chown -R ${EFF_USER}:root "${DIRNAME}"
fi
}

Expand Down Expand Up @@ -246,16 +242,14 @@ postinst ()

# Service user management
if [ -n "${EFF_USER}" ]; then
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then
# DSM 5 specific operations
# Create prefixed synouser
if ! cat /etc/passwd | grep "${EFF_USER}:x:" &> /dev/null; then
synouser --add "${EFF_USER}" "" "$USER_DESC" 0 "" 0 2>&1 | install_log
# Set HOME for consistency with DSM 6, location available even if homes not enabled
BACKUP_PASSWD="/tmp/install_${SYNOPKG_PKGNAME}_passwd"
cp /etc/passwd ${BACKUP_PASSWD} 2>&1 | install_log
sed -i "s#/var/services/homes/${EFF_USER}#/var/packages/${SYNOPKG_PKGNAME}/target#" /etc/passwd 2>&1 | install_log
fi
# DSM 5 specific operations
# Create prefixed synouser
if ! cat /etc/passwd | grep "${EFF_USER}:x:" &> /dev/null; then
synouser --add "${EFF_USER}" "" "$USER_DESC" 0 "" 0 2>&1 | install_log
# Set HOME for consistency with DSM 6, location available even if homes not enabled
BACKUP_PASSWD="/tmp/install_${SYNOPKG_PKGNAME}_passwd"
cp /etc/passwd ${BACKUP_PASSWD} 2>&1 | install_log
sed -i "s#/var/services/homes/${EFF_USER}#/var/packages/${SYNOPKG_PKGNAME}/target#" /etc/passwd 2>&1 | install_log
fi
# Register service in "users" group to access any content
if [ "$ADD_USER_IN_USERS" = "yes" ]; then
Expand Down
4 changes: 2 additions & 2 deletions mk/spksrc.service.installer.dsm6
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ set_unix_permissions ()
DIRNAME=$1
if [ -n "${EFF_USER}" ]; then
echo "Granting '${EFF_USER}' unix ownership on ${DIRNAME}"
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then
chown -R ${EFF_USER}:root "${DIRNAME}"
if [ -n "${GROUP}" ]; then
chown -R ${EFF_USER}:${GROUP} "${DIRNAME}"
else
chown -R ${EFF_USER}:${USER} "${DIRNAME}"
fi
Expand Down
Loading

0 comments on commit 5ce6622

Please sign in to comment.