databases/couchdb3: update to 3.4.2, resolve PR282217

- include QuickJS engine
- support xxHash for data integrity checksums
- improved mango keys-only indexes
- https://blog.couchdb.org/2024/10/22/3-4-2/
- https://docs.couchdb.org/en/stable/whatsnew/3.4.html

- ensure snappy NIF is compiled without optimisations to avoid
    corrupted documents under newer clang versions, used in
    in 14.1-RELEASE (see PR282217 for details)

Sponsored by:	SkunkWerks, GmbH

PR:		282217
This commit is contained in:
Dave Cottlehuber 2024-11-22 15:02:32 +00:00
parent 4dd0bdb22a
commit 6924dfdf7e
9 changed files with 849 additions and 221 deletions

View file

@ -5,6 +5,24 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20241122
AFFECTS: users of databases/couchdb3
AUTHOR: dch@FreeBSD.org
Users who installed or upgraded to CouchDB 3.3.3 *after* 2024-09-30, and
who are also running 14.1-RELEASE or newer, will hit a nasty corruption bug,
causing all CPUs to lock up, possibly crashing, and generating a lot of
errors in log files.
This bug is caused by corrupt docs after decompression, due to a clash
between improved compiler optimisations in clang18, and a bug in snappy
itself. Given the above symptoms, all affected users will have noticed.
Upgrade to 3.4.2 in ports, to resolve this issue.
Please read more about this issue here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282217
20241115
AFFECTS: users of filesystems/zrepl-dsh2dsh
AUTHOR: dsh@bamus.cz

View file

@ -1,6 +1,5 @@
PORTNAME= couchdb3
DISTVERSION= 3.3.3
PORTREVISION= 1
DISTVERSION= 3.4.2
CATEGORIES= databases
MASTER_SITES= APACHE/couchdb/source/${DISTVERSION}
DISTNAME= apache-couchdb-${DISTVERSION}
@ -16,7 +15,6 @@ BUILD_DEPENDS= erlang-runtime${_ERLVER}>=${_ERLVER}.0:lang/erlang-runtime${_ERLV
rebar:devel/rebar
LIB_DEPENDS= libicudata.so:devel/icu \
libmozjs-91.so:lang/spidermonkey91
RUN_DEPENDS= erlang-runtime${_ERLVER}>=${_ERLVER}.0:lang/erlang-runtime${_ERLVER}
USES= compiler:c++17-lang cpe gmake libtool ncurses
CPE_VENDOR= apache
@ -51,7 +49,7 @@ OPTIONS_SUB= yes
_APPDIR= ${LOCALBASE}/libexec/${PORTNAME}
_DBDIR?= /var/db/${PORTNAME}
_ERLVER?= 25
_ERLVER?= 26
_LOGDIR?= /var/log/${PORTNAME}
_LOGFILE?= ${_LOGDIR}/couch.log
_RELDIR= ${_APPDIR}/releases/${DISTVERSION}
@ -83,40 +81,48 @@ post-patch:
.endif
pre-install:
# prune build artefacts and surplus headers
${FIND} -E ${WRKSRC} -type f \
-regex '.*\.(a|buildinfo|c|cc|cmd|d|o|orig|h|cpp)' -print -delete
do-install:
# relocate user-modifiable runtime configs to match hier(7)
${MKDIR} ${STAGEDIR}${ETCDIR}
${MKDIR} ${STAGEDIR}${ETCDIR} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}
${INSTALL_DATA} ${WRKSRC}/rel/couchdb/etc/local.ini \
${STAGEDIR}${ETCDIR}/local.ini.sample
${INSTALL_DATA} ${WRKSRC}/rel/couchdb/etc/vm.args \
${STAGEDIR}${ETCDIR}/vm.args.sample
${INSTALL_MAN} ${WRKSRC}/share/docs/man/apachecouchdb.1 \
${STAGEDIR}${PREFIX}/share/man/man1
# prune build artefacts and surplus headers
${FIND} -E ${WRKSRC} -type f \
-regex '.*\.(a|buildinfo|c|cc|cmd|d|o|orig|h|cpp)' -print -delete
@${CP} ${WRKSRC}/src/docs/images/favicon.ico ${WRKSRC}/share/www/
${CP} ${WRKSRC}/src/docs/images/favicon.ico ${WRKSRC}/share/www/
# remove runtime dirs and files that were moved to match hier(7)
${RM} -rv \
${WRKSRC}/rel/couchdb/erts-*/include \
${WRKSRC}/rel/couchdb/erts-*/src \
${WRKSRC}/rel/couchdb/etc/*.d \
${WRKSRC}/rel/couchdb/etc/local.ini \
${WRKSRC}/rel/couchdb/etc/vm.args \
${WRKSRC}/rel/couchdb/lib/couch-*/priv/couch*js \
${WRKSRC}/rel/couchdb/lib/couch-*/priv/couch_js/1.8.5 \
${WRKSRC}/rel/couchdb/lib/couch-*/priv/couch_js/60 \
${WRKSRC}/rel/couchdb/lib/couch-*/priv/couch_js/68 \
${WRKSRC}/rel/couchdb/lib/couch-*/priv/couch_js/86 \
${WRKSRC}/rel/couchdb/lib/couch-*/priv/priv/couchjs \
${WRKSRC}/rel/couchdb/releases/*/vm.args \
${WRKSRC}/rel/couchdb/share/docs \
${WRKSRC}/rel/couchdb/share/www \
${WRKSRC}/rel/couchdb/var
(cd ${WRKSRC}/rel/couchdb && ${COPYTREE_SHARE} . ${STAGEDIR}${_APPDIR})
${INSTALL_PROGRAM} ${WRKSRC}/rel/couchdb/bin/couchjs ${STAGEDIR}${_APPDIR}/bin/
# fauxton UI is a required component
(cd ${WRKSRC}/share/www && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR})
post-install:
@${FIND} -E ${STAGEDIR} -type f \
\( -name couchjs -o -name *.so \) \
\( -name couchjs* -o -name *.so \) \
-exec ${STRIP_CMD} {} +
@${MKDIR} \
${STAGEDIR}${_DBDIR} \
${STAGEDIR}${_LOGDIR} \
${STAGEDIR}${_RUNDIR}
# fauxton UI is a required component
(cd ${WRKSRC}/share/www && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR})
post-install-DOCS-on:
(cd ${WRKSRC}/share/docs/html && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}/docs)

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1702805372
SHA256 (apache-couchdb-3.3.3.tar.gz) = 7a2007b5f673d4be22a25c9a111d9066919d872ddb9135a7dcec0122299bd39e
SIZE (apache-couchdb-3.3.3.tar.gz) = 18899763
TIMESTAMP = 1729600712
SHA256 (apache-couchdb-3.4.2.tar.gz) = d27ff2a13356000296a98ab884caf3d175927cf21727963ff90fab3a747544cf
SIZE (apache-couchdb-3.4.2.tar.gz) = 19242582

View file

@ -26,15 +26,11 @@ load_rc_config $name
: ${%%PORTNAME%%_erl_flags="-couch_ini %%APPDIR%%/etc/default.ini %%ETCDIR%%/local.ini"}
: ${%%PORTNAME%%_chdir="/var/db/%%PORTNAME%%"}
command="%%ERL_PATH%%"
command="%%PREFIX%%/libexec/%%PORTNAME%%/bin/couchdb"
pidfile="/var/run/${name}.pid"
daemonpidfile="/var/run/${name}-daemon.pid"
erl_sasl='-sasl releases_dir \"%%PORTNAME%%/releases\"'
erl_boot='-boot %%RELDIR%%/couchdb -boot_var RELTOOL_EXT_LIB %%APPDIR%%/lib'
erl_args='-args_file %%ETCDIR%%/vm.args'
erl_flags="${erl_sasl} ${erl_boot} ${erl_args} ${%%PORTNAME%%_erl_flags}"
%%PORTNAME%%_start()
{
# chdir manually as overriding _start() blocks rc.subr defaults
@ -47,8 +43,8 @@ erl_flags="${erl_sasl} ${erl_boot} ${erl_args} ${%%PORTNAME%%_erl_flags}"
HOME=/var/run/%%PORTNAME%% \
ERL_CRASH_DUMP=/var/run/%%PORTNAME%%/erl_crash.dump \
COUCHDB_FAUXTON_DOCROOT=%%WWWDIR%% \
COUCHDB_QUERY_SERVER_JAVASCRIPT="%%APPDIR%%/bin/couchjs %%APPDIR%%/share/server/main.js" \
COUCHDB_QUERY_SERVER_COFFEESCRIPT="%%APPDIR%%/bin/couchjs %%APPDIR%%/share/server/main-coffee.js" \
COUCHDB_ARGS_FILE=%%PREFIX%%/etc/couchdb3/vm.args \
COUCHDB_INI_FILES='%%PREFIX%%/libexec/couchdb3/etc/default.ini %%PREFIX%%/etc/couchdb3/local.ini' \
${command}
}

View file

@ -1,4 +1,4 @@
--- configure.orig 2023-01-08 13:30:40 UTC
--- configure.orig 2024-10-01 06:38:09 UTC
+++ configure
@@ -19,7 +19,7 @@ basename=`basename $0`
rootdir="$(cd "${0%/*}" 2>/dev/null; echo "$PWD")"
@ -7,24 +7,29 @@
-PACKAGE_AUTHOR_NAME="The Apache Software Foundation"
+PACKAGE_AUTHOR_NAME="FreeBSD"
REBAR3_BRANCH="main"
@@ -247,12 +247,12 @@ cat > rel/couchdb.config << EOF
REBAR3_BRANCH="3.23.0"
ERLFMT_VERSION="v1.3.0"
@@ -369,16 +369,16 @@ cat > rel/couchdb.config << EOF
% The contents of this file are auto-generated by configure
%
{package_author_name, "$PACKAGE_AUTHOR_NAME"}.
-{prefix, "."}.
-{data_dir, "./data"}.
-{view_index_dir, "./data"}.
-{state_dir, "./data"}.
-{log_file, "$LOG_FILE"}.
-{fauxton_root, "./share/www"}.
-{nouveau_index_dir, "./data/nouveau"}.
+{prefix, "%%APPDIR%%"}.
+{data_dir, "%%DBDIR%%"}.
+{view_index_dir, "%%DBDIR%%"}.
+{nouveau_index_dir, "%%DBDIR%%/nouveau"}.
{nouveau_url, "http://127.0.0.1:5987"}.
{nouveau_port, 5987}.
{nouveau_admin_port, 5988}.
-{state_dir, "./data"}.
-{log_file, "$LOG_FILE"}.
-{fauxton_root, "./share/www"}.
+{state_dir, "%%DBDIR%%"}.
+{log_file, "%%LOG_FILE%%"}.
+{fauxton_root, "%%WWWDIR%%"}.
{user, "$COUCHDB_USER"}.
{js_engine, "$JS_ENGINE"}.
{spidermonkey_version, "$SM_VSN"}.
{node_name, "-name couchdb@127.0.0.1"}.

View file

@ -1,6 +1,6 @@
--- rel/overlay/etc/vm.args.orig 2022-12-22 07:53:22 UTC
--- rel/overlay/etc/vm.args.orig 2024-10-14 18:24:54 UTC
+++ rel/overlay/etc/vm.args
@@ -63,7 +63,7 @@ +Bd -noinput
@@ -75,7 +75,7 @@ +Bd -noinput
# Comment this line out to enable the interactive Erlang shell on startup
+Bd -noinput

View file

@ -1,10 +0,0 @@
--- rel/reltool.config.orig 2018-08-20 14:11:32 UTC
+++ rel/reltool.config
@@ -11,6 +11,7 @@
% the License.
{sys, [
+ {excl_lib, otp_root}, %% require erts runtime from FreeBSD ports
{lib_dirs, ["../src"]},
{rel, "couchdb", "3.3.2", [
%% stdlib

View file

@ -0,0 +1,11 @@
--- src/snappy/rebar.config.orig 2024-11-17 19:38:49 UTC
+++ src/snappy/rebar.config
@@ -2,7 +2,7 @@
{port_sources, ["c_src/*.cc",
"c_src/snappy/*.cc"]}.
{port_env, [
- {"CXXFLAGS", "$CXXFLAGS -DNDEBUG"},
+ {"CXXFLAGS", "$CXXFLAGS -DNDEBUG -O0"},
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
"LDFLAGS", "$LDFLAGS -lstdc++"}
]}.

File diff suppressed because it is too large Load diff