git: 2236885f4e45 - main - databases/mongodb70: 7.0.23

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Thu, 28 Aug 2025 13:01:44 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2236885f4e45ece08506ad9da22c9a0232cfbf8b

commit 2236885f4e45ece08506ad9da22c9a0232cfbf8b
Author:     Ronald Klop <ronald@FreeBSD.org>
AuthorDate: 2025-08-12 10:57:47 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2025-08-28 13:01:04 +0000

    databases/mongodb70: 7.0.23
    
    Includes patch to implement waitable atomics for FreeBSD for
    https://jira.mongodb.org/browse/SERVER-81797.
    This patch is developed by me. It did not go through QA of MongoDB Inc.
    I asked to upstream the patch but they don't want to take responsibilty
    for code they don't run themselves. (Which I can understand from their
    perspective.)
    https://github.com/mongodb/mongo/pull/1607#issuecomment-2996276435
    https://jira.mongodb.org/browse/SERVER-99225
    Anyway, this has run without errors for a while on my Raspberry Pi + net-mgmt/unifi9.
    I don't have full QA in place and could only do limited testing. I can't
    take any responsibilty for the quality of the patch.
    
    Make backups and test for yourself in your setup before upgrading
    any critical production environment.
    
    Changes:
    https://www.mongodb.com/docs/manual/release-notes/7.0/#7.0.23---aug-13--2025
    
    Announcement:
    https://www.mongodb.com/community/forums/t/mongodb-7-0-23-is-released/327242?u=r_k
---
 UPDATING                                           | 12 ++++
 databases/mongodb70/Makefile                       |  2 +-
 databases/mongodb70/distinfo                       |  6 +-
 .../patch-src_mongo_platform_waitable__atomic.cpp  | 64 ++++++++++++++++++++++
 .../patch-src_mongo_platform_waitable__atomic.cpp  |  6 ++
 5 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/UPDATING b/UPDATING
index bc46a74adace..bda53ae67f4b 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,18 @@ 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.
 
+20250828:
+  AFFECTS: users of databases/mongodb70, databases/mongodb80
+  AUTHOR: ronald@FreeBSD.org
+
+  Ports mongodb70 7.0.23 and mongodb80 since 8.0.0 contain a patch to
+  implement waitable atomics for FreeBSD.
+  This patch is developed by me. It did not go through QA of MongoDB Inc.
+  I don't have full QA in place and could only do limited testing. I
+  can't take any responsibilty for the quality of the patch.
+  Make backups and test for yourself in your setup before upgrading
+  any critical production environment.
+
 20250817:
   AFFECTS: users of lang/perl5.*
   AUTHOR: mat@FreeBSD.org
diff --git a/databases/mongodb70/Makefile b/databases/mongodb70/Makefile
index cae523d04275..44cf0365bf58 100644
--- a/databases/mongodb70/Makefile
+++ b/databases/mongodb70/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	mongodb
 DISTVERSIONPREFIX=	r
-DISTVERSION=	7.0.22
+DISTVERSION=	7.0.23
 CATEGORIES=	databases net
 PKGNAMESUFFIX=	${DISTVERSION:R:S/.//}
 
diff --git a/databases/mongodb70/distinfo b/databases/mongodb70/distinfo
index cfdc23e0420e..bf5b39db08b1 100644
--- a/databases/mongodb70/distinfo
+++ b/databases/mongodb70/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1752738065
-SHA256 (mongodb-mongo-r7.0.22_GH0.tar.gz) = 031f7e924d1094c001621075f87cb466a84c975702a42796827d1456d4d57857
-SIZE (mongodb-mongo-r7.0.22_GH0.tar.gz) = 87803554
+TIMESTAMP = 1754633156
+SHA256 (mongodb-mongo-r7.0.23_GH0.tar.gz) = 31a59b83ecdf65ba26453eb244682f18aa02204a0017e872dd28008b8d471bde
+SIZE (mongodb-mongo-r7.0.23_GH0.tar.gz) = 87871275
 SHA256 (mongodb-forks-spidermonkey-5acd3be6c9563ad3e7ca6182285c69a38de47bab_GH0.tar.gz) = 1420533e23970171ff7a420e3ded1ea493e1976fb8896a5fd6f35e5b2d75733b
 SIZE (mongodb-forks-spidermonkey-5acd3be6c9563ad3e7ca6182285c69a38de47bab_GH0.tar.gz) = 280439685
diff --git a/databases/mongodb70/files/patch-src_mongo_platform_waitable__atomic.cpp b/databases/mongodb70/files/patch-src_mongo_platform_waitable__atomic.cpp
new file mode 100644
index 000000000000..6f1b397699a3
--- /dev/null
+++ b/databases/mongodb70/files/patch-src_mongo_platform_waitable__atomic.cpp
@@ -0,0 +1,64 @@
+# Original upstream implementation:
+#   https://jira.mongodb.org/browse/SERVER-81797
+# Attempt to upstream this patch:
+#   https://github.com/mongodb/mongo/pull/1607
+#   https://jira.mongodb.org/browse/SERVER-99225
+#
+--- src/mongo/platform/waitable_atomic.cpp.orig	2024-11-20 23:53:48 UTC
++++ src/mongo/platform/waitable_atomic.cpp
+@@ -34,6 +34,9 @@
+ #ifdef __linux__
+ #include <linux/futex.h>
+ #include <sys/syscall.h>
++#elif defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/umtx.h>
+ #elif defined(_WIN32)
+ #include <synchapi.h>
+ #endif
+@@ -233,6 +236,45 @@ bool waitUntil(const void* uaddr,
+     // There isn't a good list of possible errors, so assuming that anything other than a timeout
+     // error is a possible spurious wakeup.
+     return timeoutOverflow || errno != ETIMEDOUT;
++}
++
++#elif defined(__FreeBSD__)
++
++void notifyOne(const void* uaddr) {
++    _umtx_op(const_cast<void*>(uaddr), UMTX_OP_WAKE_PRIVATE, 1, NULL, NULL);
++}
++
++void notifyMany(const void* uaddr, int nToWake) {
++    _umtx_op(const_cast<void*>(uaddr), UMTX_OP_WAKE_PRIVATE, nToWake, NULL, NULL);
++}
++
++void notifyAll(const void* uaddr) {
++    _umtx_op(const_cast<void*>(uaddr), UMTX_OP_WAKE_PRIVATE, INT_MAX, NULL, NULL);
++}
++
++bool waitUntil(const void* uaddr,
++               uint32_t old,
++               boost::optional<system_clock::time_point> deadline) {
++    struct _umtx_time umtx_deadline;
++    void* uaddr2 = nullptr;
++
++    if (deadline) {
++        umtx_deadline._timeout.tv_sec = durationCount<Seconds>(deadline->time_since_epoch());
++        umtx_deadline._timeout.tv_nsec = durationCount<Nanoseconds>(
++                deadline->time_since_epoch() - stdx::chrono::seconds(umtx_deadline._timeout.tv_sec));
++        umtx_deadline._flags = UMTX_ABSTIME;
++        umtx_deadline._clockid = CLOCK_REALTIME_FAST;
++        uaddr2 = &umtx_deadline;
++    }
++
++    int umtxOpRet;
++    if ((umtxOpRet = _umtx_op(const_cast<void*>(uaddr), UMTX_OP_WAIT_UINT_PRIVATE, old, (void*)sizeof(struct _umtx_time), uaddr2)) != 0) {
++        if (errno == ETIMEDOUT) {
++            return false;
++        }
++        invariant(umtxOpRet == 0, errorMessage(lastSystemError()));
++    }
++    return true;
+ }
+ 
+ #else
diff --git a/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp b/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp
index e2c815567836..6f1b397699a3 100644
--- a/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp
+++ b/databases/mongodb80/files/patch-src_mongo_platform_waitable__atomic.cpp
@@ -1,3 +1,9 @@
+# Original upstream implementation:
+#   https://jira.mongodb.org/browse/SERVER-81797
+# Attempt to upstream this patch:
+#   https://github.com/mongodb/mongo/pull/1607
+#   https://jira.mongodb.org/browse/SERVER-99225
+#
 --- src/mongo/platform/waitable_atomic.cpp.orig	2024-11-20 23:53:48 UTC
 +++ src/mongo/platform/waitable_atomic.cpp
 @@ -34,6 +34,9 @@