PYTHON-3712 Deprecate sharded-replicaset topology type and clean up redundant runOnRequirements (#2232)

This commit is contained in:
Steven Silvester 2025-03-26 17:39:10 -05:00 committed by GitHub
parent 2149567ed3
commit 4e5166b29a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 165 additions and 46 deletions

View File

@ -678,7 +678,6 @@ class ClientContext:
"single",
"replicaset",
"sharded",
"sharded-replicaset",
"load-balanced",
}
if unknown:
@ -693,16 +692,6 @@ class ClientContext:
return True
if "sharded" in topologies and self.is_mongos:
return True
if "sharded-replicaset" in topologies and self.is_mongos:
shards = client_context.client.config.shards.find().to_list()
for shard in shards:
# For a 3-member RS-backed sharded cluster, shard['host']
# will be 'replicaName/ip1:port1,ip2:port2,ip3:port3'
# Otherwise it will be 'ip1:port1'
host_spec = shard["host"]
if not len(host_spec.split("/")) > 1:
return False
return True
return False
def require_cluster_type(self, topologies=None):

View File

@ -680,7 +680,6 @@ class AsyncClientContext:
"single",
"replicaset",
"sharded",
"sharded-replicaset",
"load-balanced",
}
if unknown:
@ -695,16 +694,6 @@ class AsyncClientContext:
return True
if "sharded" in topologies and self.is_mongos:
return True
if "sharded-replicaset" in topologies and self.is_mongos:
shards = await async_client_context.client.config.shards.find().to_list()
for shard in shards:
# For a 3-member RS-backed sharded cluster, shard['host']
# will be 'replicaName/ip1:port1,ip2:port2,ip3:port3'
# Otherwise it will be 'ip1:port1'
host_spec = shard["host"]
if not len(host_spec.split("/")) > 1:
return False
return True
return False
def require_cluster_type(self, topologies=None):

View File

@ -28,7 +28,6 @@
"minServerVersion": "4.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
],

View File

@ -28,7 +28,6 @@
"minServerVersion": "6.1.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
],

View File

@ -145,7 +145,7 @@
"minServerVersion": "4.1.11",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
@ -190,7 +190,7 @@
"minServerVersion": "4.2",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}

View File

@ -6,7 +6,7 @@
"minServerVersion": "6.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"

View File

@ -6,7 +6,7 @@
"minServerVersion": "3.6",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.3.1",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"

View File

@ -6,9 +6,9 @@
"minServerVersion": "6.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded"
]
],
"serverless": "forbid"
}
],
"createEntities": [
@ -462,7 +462,6 @@
"runOnRequirements": [
{
"topologies": [
"sharded-replicaset",
"sharded"
]
}

View File

@ -3,7 +3,8 @@
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
"minServerVersion": "4.4",
"serverless": "forbid"
}
],
"createEntities": [
@ -417,6 +418,141 @@
]
}
]
},
{
"description": "apply remaining timeoutMS if less than maxAwaitTimeMS",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"getMore"
],
"blockConnection": true,
"blockTimeMS": 30
}
}
}
},
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {
"_id": 1
},
"cursorType": "tailableAwait",
"batchSize": 1,
"maxAwaitTimeMS": 100,
"timeoutMS": 200
},
"saveResultAsEntity": "tailableCursor"
},
{
"name": "iterateOnce",
"object": "tailableCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "tailableCursor",
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"ignoreExtraEvents": true,
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test"
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"maxTimeMS": {
"$$lte": 100
}
}
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"maxTimeMS": {
"$$lte": 70
}
}
}
}
]
}
]
},
{
"description": "apply maxAwaitTimeMS if less than remaining timeout",
"operations": [
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {},
"cursorType": "tailableAwait",
"batchSize": 1,
"maxAwaitTimeMS": 100,
"timeoutMS": 200
},
"saveResultAsEntity": "tailableCursor"
},
{
"name": "iterateOnce",
"object": "tailableCursor"
},
{
"name": "iterateOnce",
"object": "tailableCursor"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test"
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"maxTimeMS": {
"$$lte": 100
}
}
}
}
]
}
]
}
]
}

View File

@ -5,8 +5,7 @@
{
"topologies": [
"single",
"sharded",
"sharded-replicaset"
"sharded"
],
"serverless": "forbid"
}

View File

@ -229,7 +229,6 @@
{
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
]
@ -493,7 +492,7 @@
{
"minServerVersion": "4.2",
"topologies": [
"sharded-replicaset",
"sharded",
"load-balanced"
]
}

View File

@ -11,7 +11,7 @@
{
"minServerVersion": "4.1.8",
"topologies": [
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -6,7 +6,7 @@
"minServerVersion": "5.0",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -6,7 +6,7 @@
"minServerVersion": "5.0",
"topologies": [
"replicaset",
"sharded-replicaset"
"sharded"
]
}
],

View File

@ -42,7 +42,9 @@
"arguments": {
"document": {
"_id": 1,
"y": 1
"x": 2,
"y": 3,
"z": 4
}
}
}
@ -58,10 +60,18 @@
"documents": [
{
"_id": {
"$$lte": 1
"$$lte": 2
},
"x": {
"$$lte": 2.1
},
"y": {
"$$lte": 2
"$$lte": {
"$numberLong": "3"
}
},
"z": {
"$$lte": 4
}
}
]

View File

@ -6,7 +6,7 @@
"minServerVersion": "4.9",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
@ -92,7 +92,7 @@
{
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
@ -221,7 +221,7 @@
{
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}