Skip to content

Commit e651eb7

Browse files
authored
CSHARP-5535: Bump maxWireVersion for MongoDB 8.2 (#1642)
1 parent c8050dc commit e651eb7

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ internal static class WireVersion
124124
/// Wire version 26.
125125
/// </summary>
126126
public const int Server81 = 26;
127+
/// <summary>
128+
/// Wire version 27.
129+
/// </summary>
130+
public const int Server82 = 27;
127131

128132
// note: keep WireVersion.cs and ServerVersion.cs in sync
129133

@@ -162,9 +166,10 @@ internal static class WireVersion
162166
new WireVersionInfo(wireVersion: 24, major: 7, minor: 3),
163167
new WireVersionInfo(wireVersion: 25, major: 8, minor: 0),
164168
new WireVersionInfo(wireVersion: 26, major: 8, minor: 1),
169+
new WireVersionInfo(wireVersion: 27, major: 8, minor: 2),
165170
};
166171

167-
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: Server40, maxWireVersion: Server81);
172+
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: Server40, maxWireVersion: Server82);
168173

169174
private static Range<int> CreateSupportedWireVersionRange(int minWireVersion, int maxWireVersion)
170175
{

src/MongoDB.Driver/ServerVersion.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,16 @@ public enum ServerVersion
143143
/// Server version 8.0.
144144
/// </summary>
145145
Server80,
146-
146+
147147
/// <summary>
148148
/// Server version 8.1.
149149
/// </summary>
150-
Server81
150+
Server81,
151+
152+
/// <summary>
153+
/// Server version 8.2.
154+
/// </summary>
155+
Server82
151156

152157
// note: keep Server.cs and WireVersion.cs in sync as well as the extension methods below
153158
}
@@ -183,6 +188,7 @@ public static ServerVersion ToServerVersion(this int wireVersion)
183188
WireVersion.Server73 => ServerVersion.Server73,
184189
WireVersion.Server80 => ServerVersion.Server80,
185190
WireVersion.Server81 => ServerVersion.Server81,
191+
WireVersion.Server82 => ServerVersion.Server82,
186192
_ => throw new ArgumentException($"Invalid write version: {wireVersion}.", nameof(wireVersion))
187193
};
188194
}
@@ -217,6 +223,7 @@ public static int ToWireVersion(this ServerVersion? serverVersion)
217223
ServerVersion.Server73 => WireVersion.Server73,
218224
ServerVersion.Server80 => WireVersion.Server80,
219225
ServerVersion.Server81 => WireVersion.Server81,
226+
ServerVersion.Server82 => WireVersion.Server82,
220227
_ => throw new ArgumentException($"Invalid server version: {serverVersion}.", nameof(serverVersion))
221228
};
222229
}

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, 26));
67+
result.Should().Be(new Range<int>(7, 27));
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(27, 28, false)]
328-
[InlineData(27, 28, true)]
327+
[InlineData(28, 29, false)]
328+
[InlineData(28, 29, 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, 26));
49+
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(7, 27));
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(27, null, null)]
62+
[InlineData(28, null, null)]
63+
[InlineData(27, 8, 2)]
6364
[InlineData(26, 8, 1)]
6465
[InlineData(25, 8, 0)]
6566
[InlineData(24, 7, 3)]

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

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

0 commit comments

Comments
 (0)