Skip to content

Commit 11bc211

Browse files
authored
CSHARP-5510: Bump maxWireVersion for MongoDB 8.1 (#1624)
1 parent 3805737 commit 11bc211

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

src/MongoDB.Driver/Core/Misc/WireVersion.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ internal static class WireVersion
120120
/// Wire version 25.
121121
/// </summary>
122122
public const int Server80 = 25;
123+
/// <summary>
124+
/// Wire version 26.
125+
/// </summary>
126+
public const int Server81 = 26;
123127

124128
// note: keep WireVersion.cs and ServerVersion.cs in sync
125129

@@ -157,9 +161,10 @@ internal static class WireVersion
157161
new WireVersionInfo(wireVersion: 23, major: 7, minor: 2),
158162
new WireVersionInfo(wireVersion: 24, major: 7, minor: 3),
159163
new WireVersionInfo(wireVersion: 25, major: 8, minor: 0),
164+
new WireVersionInfo(wireVersion: 26, major: 8, minor: 1),
160165
};
161166

162-
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: Server40, maxWireVersion: Server80);
167+
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: Server40, maxWireVersion: Server81);
163168

164169
private static Range<int> CreateSupportedWireVersionRange(int minWireVersion, int maxWireVersion)
165170
{

src/MongoDB.Driver/ServerVersion.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ public enum ServerVersion
142142
/// <summary>
143143
/// Server version 8.0.
144144
/// </summary>
145-
Server80
145+
Server80,
146+
147+
/// <summary>
148+
/// Server version 8.1.
149+
/// </summary>
150+
Server81
146151

147152
// note: keep Server.cs and WireVersion.cs in sync as well as the extension methods below
148153
}
@@ -177,6 +182,7 @@ public static ServerVersion ToServerVersion(this int wireVersion)
177182
WireVersion.Server72 => ServerVersion.Server72,
178183
WireVersion.Server73 => ServerVersion.Server73,
179184
WireVersion.Server80 => ServerVersion.Server80,
185+
WireVersion.Server81 => ServerVersion.Server81,
180186
_ => throw new ArgumentException($"Invalid write version: {wireVersion}.", nameof(wireVersion))
181187
};
182188
}
@@ -210,6 +216,7 @@ public static int ToWireVersion(this ServerVersion? serverVersion)
210216
ServerVersion.Server72 => WireVersion.Server72,
211217
ServerVersion.Server73 => WireVersion.Server73,
212218
ServerVersion.Server80 => WireVersion.Server80,
219+
ServerVersion.Server81 => WireVersion.Server81,
213220
_ => throw new ArgumentException($"Invalid server version: {serverVersion}.", nameof(serverVersion))
214221
};
215222
}

tests/MongoDB.Driver.Tests/Core/Clusters/ClusterTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void SupportedWireVersionRange_should_return_expected_result()
6464
{
6565
var result = Cluster.SupportedWireVersionRange;
6666

67-
result.Should().Be(new Range<int>(7, 25));
67+
result.Should().Be(new Range<int>(7, 26));
6868
}
6969

7070
[Fact]
@@ -324,8 +324,8 @@ public void SelectServer_should_throw_if_the_matched_server_cannot_be_found_and_
324324
[Theory]
325325
[InlineData(0, 0, false)]
326326
[InlineData(0, 0, true)]
327-
[InlineData(26, 27, false)]
328-
[InlineData(26, 27, true)]
327+
[InlineData(27, 28, false)]
328+
[InlineData(27, 28, true)]
329329
public void SelectServer_should_throw_if_any_servers_are_incompatible(int min, int max, bool async)
330330
{
331331
var subject = CreateSubject();

tests/MongoDB.Driver.Tests/Core/Misc/WireVersionTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void GetServerVersionForErrorMessage_should_return_expected_serverVersion
4646
[Fact]
4747
public void SupportedWireRange_should_be_correct()
4848
{
49-
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(7, 25));
49+
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(7, 26));
5050
}
5151

5252
[Fact]
@@ -59,7 +59,8 @@ public void ToServerVersion_should_throw_if_wireVersion_less_than_0()
5959

6060
[Theory]
6161
[InlineData(99, null, null)]
62-
[InlineData(26, null, null)]
62+
[InlineData(27, null, null)]
63+
[InlineData(26, 8, 1)]
6364
[InlineData(25, 8, 0)]
6465
[InlineData(24, 7, 3)]
6566
[InlineData(23, 7, 2)]

tests/MongoDB.Driver.Tests/Core/Servers/ServerDescriptionTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ public void Equals_should_return_true_when_all_fields_are_equal()
286286
[InlineData(new[] { 23, 24 }, true)]
287287
[InlineData(new[] { 24, 25 }, true)]
288288
[InlineData(new[] { 25, 26 }, true)]
289-
[InlineData(new[] { 26, 27 }, false)]
289+
[InlineData(new[] { 26, 27 }, true)]
290+
[InlineData(new[] { 27, 28 }, false)]
290291
public void IsCompatibleWithDriver_should_return_expected_result(int[] minMaxWireVersions, bool expectedResult)
291292
{
292293
var clusterId = new ClusterId(1);

0 commit comments

Comments
 (0)