Skip to content

Commit d8f8f7e

Browse files
authored
CSHARP-5688: Bump maxWireVersion for MongoDB 8.3 (#1746)
1 parent eebe3c6 commit d8f8f7e

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ internal static class WireVersion
128128
/// Wire version 27.
129129
/// </summary>
130130
public const int Server82 = 27;
131+
/// <summary>
132+
/// Wire version 28.
133+
/// </summary>
134+
public const int Server83 = 28;
131135

132136
// note: keep WireVersion.cs and ServerVersion.cs in sync
133137

@@ -167,9 +171,10 @@ internal static class WireVersion
167171
new WireVersionInfo(wireVersion: 25, major: 8, minor: 0),
168172
new WireVersionInfo(wireVersion: 26, major: 8, minor: 1),
169173
new WireVersionInfo(wireVersion: 27, major: 8, minor: 2),
174+
new WireVersionInfo(wireVersion: 28, major: 8, minor: 3)
170175
};
171176

172-
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: Server42, maxWireVersion: Server82);
177+
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: Server42, maxWireVersion: Server83);
173178

174179
private static Range<int> CreateSupportedWireVersionRange(int minWireVersion, int maxWireVersion)
175180
{

src/MongoDB.Driver/ServerVersion.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ public enum ServerVersion
152152
/// <summary>
153153
/// Server version 8.2.
154154
/// </summary>
155-
Server82
155+
Server82,
156+
157+
/// <summary>
158+
/// Server version 8.3.
159+
/// </summary>
160+
Server83
156161

157162
// note: keep Server.cs and WireVersion.cs in sync as well as the extension methods below
158163
}
@@ -189,7 +194,8 @@ public static ServerVersion ToServerVersion(this int wireVersion)
189194
WireVersion.Server80 => ServerVersion.Server80,
190195
WireVersion.Server81 => ServerVersion.Server81,
191196
WireVersion.Server82 => ServerVersion.Server82,
192-
_ => throw new ArgumentException($"Invalid write version: {wireVersion}.", nameof(wireVersion))
197+
WireVersion.Server83 => ServerVersion.Server83,
198+
_ => throw new ArgumentException($"Invalid wire version: {wireVersion}.", nameof(wireVersion))
193199
};
194200
}
195201

@@ -224,6 +230,7 @@ public static int ToWireVersion(this ServerVersion? serverVersion)
224230
ServerVersion.Server80 => WireVersion.Server80,
225231
ServerVersion.Server81 => WireVersion.Server81,
226232
ServerVersion.Server82 => WireVersion.Server82,
233+
ServerVersion.Server83 => WireVersion.Server83,
227234
_ => throw new ArgumentException($"Invalid server version: {serverVersion}.", nameof(serverVersion))
228235
};
229236
}

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>(8, 27));
67+
result.Should().Be(new Range<int>(8, 28));
6868
}
6969

7070
[Fact]
@@ -283,8 +283,8 @@ await Record.ExceptionAsync(() => subject.SelectServerAsync(OperationContext.NoT
283283
[Theory]
284284
[InlineData(0, 0, false)]
285285
[InlineData(0, 0, true)]
286-
[InlineData(28, 29, false)]
287-
[InlineData(28, 29, true)]
286+
[InlineData(29, 30, false)]
287+
[InlineData(29, 30, true)]
288288
public async Task SelectServer_should_throw_if_any_servers_are_incompatible(int min, int max, bool async)
289289
{
290290
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
@@ -47,7 +47,7 @@ public void GetServerVersionForErrorMessage_should_return_expected_serverVersion
4747
[Fact]
4848
public void SupportedWireRange_should_be_correct()
4949
{
50-
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(8, 27));
50+
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(8, 28));
5151
}
5252

5353
[Fact]
@@ -60,7 +60,8 @@ public void ToServerVersion_should_throw_if_wireVersion_less_than_0()
6060

6161
[Theory]
6262
[InlineData(99, null, null)]
63-
[InlineData(28, null, null)]
63+
[InlineData(29, null, null)]
64+
[InlineData(28, 8, 3)]
6465
[InlineData(27, 8, 2)]
6566
[InlineData(26, 8, 1)]
6667
[InlineData(25, 8, 0)]

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ public void Equals_should_return_true_when_all_fields_are_equal()
266266
[InlineData(new[] { 7, 8 }, true)]
267267
[InlineData(new[] { 8, 8 }, true)]
268268
[InlineData(new[] { 8, 21 }, true)]
269-
[InlineData(new[] { 27, 27 }, true)]
270-
[InlineData(new[] { 27, 28 }, true)]
271-
[InlineData(new[] { 28, 28 }, false)]
272-
[InlineData(new[] { 28, 29 }, false)]
269+
[InlineData(new[] { 28, 28 }, true)]
270+
[InlineData(new[] { 28, 29 }, true)]
271+
[InlineData(new[] { 29, 29 }, false)]
272+
[InlineData(new[] { 29, 30 }, false)]
273273
public void IsCompatibleWithDriver_should_return_expected_result(int[] minMaxWireVersions, bool expectedResult)
274274
{
275275
var clusterId = new ClusterId(1);

0 commit comments

Comments
 (0)