From 69918ef2d58f805f3de0fe5231732cbfb29be531 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Wed, 28 Oct 2026 14:48:53 +0000 Subject: [PATCH] Remove sticky events SQLite version checking --- synapse/storage/databases/main/sticky_events.py | 10 ---------- tests/federation/test_federation_catch_up.py | 5 ----- tests/replication/test_sharded_sticky_events.py | 6 ------ .../sliding_sync/test_extension_sticky_events.py | 6 ------ tests/rest/client/test_delayed_events.py | 8 -------- tests/rest/client/test_sticky_events.py | 6 ------ tests/rest/client/test_sync_sticky_events.py | 6 ------ tests/storage/test_sticky_events.py | 9 --------- 8 files changed, 56 deletions(-) diff --git a/synapse/storage/databases/main/sticky_events.py b/synapse/storage/databases/main/sticky_events.py index afb77c43fc..4ed7285fd9 100644 --- a/synapse/storage/databases/main/sticky_events.py +++ b/synapse/storage/databases/main/sticky_events.py @@ -128,16 +128,6 @@ class StickyEventsWorkerStore(StateGroupWorkerStore, CacheInvalidationWorkerStor writers=hs.config.worker.writers.events, ) - if hs.config.experimental.msc4354_enabled and isinstance( - self.database_engine, Sqlite3Engine - ): - import sqlite3 - - if sqlite3.sqlite_version_info < (3, 40, 0): - raise RuntimeError( - f"Experimental MSC4354 Sticky Events enabled but SQLite3 version is too old: {sqlite3.sqlite_version_info}, must be at least 3.40. Disable MSC4354 Sticky Events, switch to Postgres, or upgrade SQLite. See https://github.com/element-hq/synapse/issues/19428" - ) - def process_replication_position( self, stream_name: str, instance_name: str, token: int ) -> None: diff --git a/tests/federation/test_federation_catch_up.py b/tests/federation/test_federation_catch_up.py index 9174be576e..fcbc8b600e 100644 --- a/tests/federation/test_federation_catch_up.py +++ b/tests/federation/test_federation_catch_up.py @@ -1,4 +1,3 @@ -import sqlite3 from typing import Callable, Collection from unittest import mock from unittest.mock import Mock @@ -24,7 +23,6 @@ from synapse.util.retryutils import NotRetryingDestination from tests.test_utils import event_injection from tests.unittest import FederatingHomeserverTestCase -from tests.utils import USE_POSTGRES_FOR_TESTS class _FederationCatchUpTestCaseBase(FederatingHomeserverTestCase): @@ -610,9 +608,6 @@ class FederationStickyEventCatchUpTestCase(_FederationCatchUpTestCaseBase): Tests for the catch-up of backlogged sticky events over federation. """ - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - def default_config(self) -> JsonDict: config = super().default_config() config["experimental_features"] = {"msc4354_enabled": True} diff --git a/tests/replication/test_sharded_sticky_events.py b/tests/replication/test_sharded_sticky_events.py index 9de3cc9cc3..56f1b1934a 100644 --- a/tests/replication/test_sharded_sticky_events.py +++ b/tests/replication/test_sharded_sticky_events.py @@ -11,7 +11,6 @@ # See the GNU Affero General Public License for more details: # . import logging -import sqlite3 from contextlib import contextmanager from typing import Iterator from unittest.mock import AsyncMock @@ -27,7 +26,6 @@ from synapse.util.clock import Clock from synapse.util.duration import Duration from tests.replication._base import BaseMultiWorkerStreamTestCase -from tests.utils import USE_POSTGRES_FOR_TESTS logger = logging.getLogger(__name__) @@ -37,10 +35,6 @@ class ShardedStickyEventsTestCase(BaseMultiWorkerStreamTestCase): Tests for sharded Sticky Events. """ - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - # We need the JSON functionality in SQLite - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - servlets = [ synapse.rest.admin.register_servlets_for_client_rest_resource, login.register_servlets, diff --git a/tests/rest/client/sliding_sync/test_extension_sticky_events.py b/tests/rest/client/sliding_sync/test_extension_sticky_events.py index b19c8db481..9297749ec3 100644 --- a/tests/rest/client/sliding_sync/test_extension_sticky_events.py +++ b/tests/rest/client/sliding_sync/test_extension_sticky_events.py @@ -12,7 +12,6 @@ # . # import logging -import sqlite3 from twisted.internet.testing import MemoryReactor @@ -27,7 +26,6 @@ from synapse.util.duration import Duration from tests.rest.client.sliding_sync.test_sliding_sync import SlidingSyncBase from tests.server import TimedOutException -from tests.utils import USE_POSTGRES_FOR_TESTS logger = logging.getLogger(__name__) @@ -60,10 +58,6 @@ ROOM_SUBSCRIPTION = {"required_state": [], "timeline_limit": 0} class SlidingSyncStickyEventsExtensionTestCase(SlidingSyncBase): """Tests for the sticky events sliding sync extension""" - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - # We need the JSON functionality in SQLite - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - servlets = [ synapse.rest.admin.register_servlets, login.register_servlets, diff --git a/tests/rest/client/test_delayed_events.py b/tests/rest/client/test_delayed_events.py index ecb6639ff6..c977395d92 100644 --- a/tests/rest/client/test_delayed_events.py +++ b/tests/rest/client/test_delayed_events.py @@ -14,7 +14,6 @@ """Tests REST events for /delayed_events paths.""" -import sqlite3 from http import HTTPStatus from typing import Literal, overload from unittest.mock import Mock, patch @@ -54,7 +53,6 @@ from tests import unittest from tests.replication._base import BaseMultiWorkerStreamTestCase from tests.server import FakeChannel, make_request from tests.unittest import HomeserverTestCase -from tests.utils import USE_POSTGRES_FOR_TESTS _MANAGEMENT_PATH_PREFIX = "/_matrix/client/unstable/org.matrix.msc4140/delayed_events" @@ -1503,12 +1501,6 @@ class DelayedEventsTestCase(DelayedEventsTestCaseBase): class DelayedStickyEventsTestCase(DelayedEventsTestCaseBase): """Tests scheduling delayed sticky events (MSC4354).""" - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - # We need the JSON functionality in SQLite - # (the sticky events store refuses to start without it, so this has to be - # a class-level skip: the homeserver is built before the test body runs) - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - def default_config(self) -> JsonDict: config = super().default_config() config["experimental_features"] = {"msc4354_enabled": True} diff --git a/tests/rest/client/test_sticky_events.py b/tests/rest/client/test_sticky_events.py index c62139acf2..f47cc5c189 100644 --- a/tests/rest/client/test_sticky_events.py +++ b/tests/rest/client/test_sticky_events.py @@ -13,7 +13,6 @@ # # -import sqlite3 from http import HTTPStatus from twisted.internet.testing import MemoryReactor @@ -27,7 +26,6 @@ from synapse.util.clock import Clock from synapse.util.duration import Duration from tests import unittest -from tests.utils import USE_POSTGRES_FOR_TESTS class StickyEventsClientTestCase(unittest.HomeserverTestCase): @@ -35,10 +33,6 @@ class StickyEventsClientTestCase(unittest.HomeserverTestCase): Tests for the client-server API parts of MSC4354: Sticky Events """ - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - # We need the JSON functionality in SQLite - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - servlets = [ room.register_servlets, login.register_servlets, diff --git a/tests/rest/client/test_sync_sticky_events.py b/tests/rest/client/test_sync_sticky_events.py index 5416dfa628..9bbad14347 100644 --- a/tests/rest/client/test_sync_sticky_events.py +++ b/tests/rest/client/test_sync_sticky_events.py @@ -11,7 +11,6 @@ # See the GNU Affero General Public License for more details: # . import json -import sqlite3 from dataclasses import dataclass from http import HTTPStatus from unittest.mock import patch @@ -28,7 +27,6 @@ from synapse.util.clock import Clock from synapse.util.duration import Duration from tests import unittest -from tests.utils import USE_POSTGRES_FOR_TESTS @dataclass @@ -68,10 +66,6 @@ class SyncStickyEventsTestCase(unittest.HomeserverTestCase): Tests for oldschool (v3) /sync with sticky events (MSC4354) """ - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - # We need the JSON functionality in SQLite - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - servlets = [ room.register_servlets, login.register_servlets, diff --git a/tests/storage/test_sticky_events.py b/tests/storage/test_sticky_events.py index 9c8a7937b4..554425d4b5 100644 --- a/tests/storage/test_sticky_events.py +++ b/tests/storage/test_sticky_events.py @@ -10,7 +10,6 @@ # # See the GNU Affero General Public License for more details: # . -import sqlite3 from http import HTTPStatus from immutabledict import immutabledict @@ -40,7 +39,6 @@ from tests.test_utils.event_injection import ( inject_event, inject_member_event, ) -from tests.utils import USE_POSTGRES_FOR_TESTS class StickyEventsTestCase(unittest.HomeserverTestCase): @@ -48,10 +46,6 @@ class StickyEventsTestCase(unittest.HomeserverTestCase): Tests for the storage functions related to MSC4354: Sticky Events """ - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - # We need the JSON functionality in SQLite - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - servlets = [ room.register_servlets, sync.register_servlets, @@ -904,9 +898,6 @@ class StickyEventsFederationBacklogTestCase(unittest.HomeserverTestCase): federation catch-up transaction. """ - if not USE_POSTGRES_FOR_TESTS and sqlite3.sqlite_version_info < (3, 40, 0): - skip = f"SQLite version is too old to support sticky events: {sqlite3.sqlite_version_info} (See https://github.com/element-hq/synapse/issues/19428)" - servlets = [ room.register_servlets, login.register_servlets,