Skip to content

PYTHON-5248 - Drop support for MongoDB 4.0 #2353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
642 changes: 234 additions & 408 deletions .evergreen/generated_configs/tasks.yml

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ buildvariants:
COMPRESSOR: zlib
- name: compression-zstd-rhel8
tasks:
- name: .test-standard !.server-4.0
- name: .test-standard !.server-4.2
display_name: Compression zstd RHEL8
run_on:
- rhel87-small
Expand Down Expand Up @@ -522,13 +522,6 @@ buildvariants:
PYTHON_BINARY: /opt/python/3.9/bin/python3

# Server version tests
- name: mongodb-v4.0
tasks:
- name: .server-version
display_name: "* MongoDB v4.0"
run_on:
- rhel87-small
tags: [coverage_tag]
- name: mongodb-v4.2
tasks:
- name: .server-version
Expand Down Expand Up @@ -684,11 +677,3 @@ buildvariants:
- rhel87-small
expansions:
STORAGE_ENGINE: inmemory
- name: storage-mmapv1-rhel8
tasks:
- name: .test-standard !.sharded_cluster-auth-ssl .server-4.0
display_name: Storage MMAPv1 RHEL8
run_on:
- rhel87-small
expansions:
STORAGE_ENGINE: mmapv1
12 changes: 3 additions & 9 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
get_task_name,
get_variant_name,
get_versions_from,
get_versions_until,
handle_c_ext,
write_functions_to_file,
write_tasks_to_file,
Expand Down Expand Up @@ -196,7 +195,7 @@ def create_compression_variants():
for compressor in "snappy", "zlib", "zstd":
expansions = dict(COMPRESSOR=compressor)
if compressor == "zstd":
tasks = [".test-standard !.server-4.0"]
tasks = [".test-standard !.server-4.2"]
else:
tasks = [".test-standard"]
display_name = get_variant_name(f"Compression {compressor}", host)
Expand Down Expand Up @@ -249,16 +248,11 @@ def create_pyopenssl_variants():

def create_storage_engine_variants():
host = DEFAULT_HOST
engines = ["InMemory", "MMAPv1"]
engines = ["InMemory"]
variants = []
for engine in engines:
expansions = dict(STORAGE_ENGINE=engine.lower())
if engine == engines[0]:
tasks = [".test-standard .standalone-noauth-nossl"]
else:
# MongoDB 4.2 drops support for MMAPv1
versions = get_versions_until("4.0")
tasks = [f".test-standard !.sharded_cluster-auth-ssl .server-{v}" for v in versions]
tasks = [".test-standard .standalone-noauth-nossl"]
display_name = get_variant_name(f"Storage {engine}", host)
variant = create_variant(tasks, display_name, host=host, expansions=expansions)
variants.append(variant)
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/scripts/generate_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Globals
##############

ALL_VERSIONS = ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
ALL_VERSIONS = ["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
CPYTHONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
PYPYS = ["pypy3.10"]
ALL_PYTHONS = CPYTHONS + PYPYS
Expand Down
4 changes: 2 additions & 2 deletions pymongo/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
MAX_WRITE_BATCH_SIZE = 100000

# What this version of PyMongo supports.
MIN_SUPPORTED_SERVER_VERSION = "4.0"
MIN_SUPPORTED_WIRE_VERSION = 7
MIN_SUPPORTED_SERVER_VERSION = "4.2"
MIN_SUPPORTED_WIRE_VERSION = 8
# MongoDB 8.0
MAX_SUPPORTED_WIRE_VERSION = 25

Expand Down
23 changes: 1 addition & 22 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ def _init_client(self):
self.server_status = {}
else:
self.server_status = self.client.admin.command("serverStatus")
if self.storage_engine == "mmapv1":
# MMAPv1 does not support retryWrites=True.
self.default_client_options["retryWrites"] = False

hello = self.hello
self.sessions_enabled = "logicalSessionTimeoutMinutes" in hello
Expand Down Expand Up @@ -525,19 +522,6 @@ def require_data_lake(self, func):
func=func,
)

def require_no_mmap(self, func):
"""Run a test only if the server is not using the MMAPv1 storage
engine. Only works for standalone and replica sets; tests are
run regardless of storage engine on sharded clusters.
"""

def is_not_mmap():
if self.is_mongos:
return True
return self.storage_engine != "mmapv1"

return self._require(is_not_mmap, "Storage engine must not be MMAPv1", func=func)

def require_version_min(self, *ver):
"""Run a test only if the server version is at least ``version``."""
other_version = Version(*ver)
Expand Down Expand Up @@ -674,7 +658,7 @@ def require_no_serverless(self, func):

def require_change_streams(self, func):
"""Run a test only if the server supports change streams."""
return self.require_no_mmap(self.require_no_standalone(self.require_no_serverless(func)))
return self.require_no_standalone(self.require_no_serverless(func))

def is_topology_type(self, topologies):
unknown = set(topologies) - {
Expand Down Expand Up @@ -777,8 +761,6 @@ def require_sessions(self, func):
return self._require(lambda: self.sessions_enabled, "Sessions not supported", func=func)

def supports_retryable_writes(self):
if self.storage_engine == "mmapv1":
return False
if not self.sessions_enabled:
return False
return self.is_mongos or self.is_rs
Expand All @@ -792,9 +774,6 @@ def require_retryable_writes(self, func):
)

def supports_transactions(self):
if self.storage_engine == "mmapv1":
return False

if self.version.at_least(4, 1, 8):
return self.is_mongos or self.is_rs

Expand Down
23 changes: 1 addition & 22 deletions test/asynchronous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ async def _init_client(self):
self.server_status = {}
else:
self.server_status = await self.client.admin.command("serverStatus")
if self.storage_engine == "mmapv1":
# MMAPv1 does not support retryWrites=True.
self.default_client_options["retryWrites"] = False

hello = await self.hello
self.sessions_enabled = "logicalSessionTimeoutMinutes" in hello
Expand Down Expand Up @@ -527,19 +524,6 @@ def require_data_lake(self, func):
func=func,
)

def require_no_mmap(self, func):
"""Run a test only if the server is not using the MMAPv1 storage
engine. Only works for standalone and replica sets; tests are
run regardless of storage engine on sharded clusters.
"""

def is_not_mmap():
if self.is_mongos:
return True
return self.storage_engine != "mmapv1"

return self._require(is_not_mmap, "Storage engine must not be MMAPv1", func=func)

def require_version_min(self, *ver):
"""Run a test only if the server version is at least ``version``."""
other_version = Version(*ver)
Expand Down Expand Up @@ -676,7 +660,7 @@ def require_no_serverless(self, func):

def require_change_streams(self, func):
"""Run a test only if the server supports change streams."""
return self.require_no_mmap(self.require_no_standalone(self.require_no_serverless(func)))
return self.require_no_standalone(self.require_no_serverless(func))

async def is_topology_type(self, topologies):
unknown = set(topologies) - {
Expand Down Expand Up @@ -779,8 +763,6 @@ def require_sessions(self, func):
return self._require(lambda: self.sessions_enabled, "Sessions not supported", func=func)

def supports_retryable_writes(self):
if self.storage_engine == "mmapv1":
return False
if not self.sessions_enabled:
return False
return self.is_mongos or self.is_rs
Expand All @@ -794,9 +776,6 @@ def require_retryable_writes(self, func):
)

def supports_transactions(self):
if self.storage_engine == "mmapv1":
return False

if self.version.at_least(4, 1, 8):
return self.is_mongos or self.is_rs

Expand Down
4 changes: 2 additions & 2 deletions test/asynchronous/test_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async def _test_update_many(self, update):
async def test_update_many(self):
await self._test_update_many({"$set": {"foo": "bar"}})

@async_client_context.require_version_min(4, 1, 11)
@async_client_context.require_version_min(4, 2, 0)
async def test_update_many_pipeline(self):
await self._test_update_many([{"$set": {"foo": "bar"}}])

Expand Down Expand Up @@ -206,7 +206,7 @@ async def _test_update_one(self, update):
async def test_update_one(self):
await self._test_update_one({"$set": {"foo": "bar"}})

@async_client_context.require_version_min(4, 1, 11)
@async_client_context.require_version_min(4, 2, 0)
async def test_update_one_pipeline(self):
await self._test_update_one([{"$set": {"foo": "bar"}}])

Expand Down
Loading
Loading