Skip to content

Commit 2775444

Browse files
committed
Merge pull request #378 from bgrainger/remove-buffer-result-sets
Remove BufferResultSets connection string setting. Conflicts: .travis.yml src/MySqlConnector/MySqlClient/Results/Row.cs
2 parents 08c8386 + c1ec8bf commit 2775444

File tree

13 files changed

+22
-131
lines changed

13 files changed

+22
-131
lines changed

.ci/config/config.buffer.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ script:
4040
- echo 'Executing netcoreapp2.0 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
4141
- echo 'Executing netcoreapp2.0 tests with Compression, SSL' && ../../.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
4242
- echo 'Executing netcoreapp2.0 tests with Unix Domain Socket, No Compression, No SSL' && ../../.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
43-
- echo 'Executing netcoreapp2.0 tests with Buffering, No Compression, No SSL' && ../../.ci/use-config.sh config.buffer.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet xunit -c Release -f netcoreapp2.0
4443
- popd
4544

4645
after_script:

docs/content/connection-options.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,6 @@ These are the other options that MySqlConnector supports. They are set to sensi
159159
<td>false</td>
160160
<td>Setting this to true indicates that the provider expects user variables in the SQL.</td>
161161
</tr>
162-
<tr>
163-
<td>BufferResultSets, Buffer Result Sets</td>
164-
<td>false</td>
165-
<td>Setting this to <code>true</code> immediately buffers all result sets to memory upon calling ExecuteReader/ExecuteReaderAsync. This will allow the connection
166-
to execute another statement while still holding the original postion of the reader. Do not use when result sets are bigger than available memory. When this is <code>true</code>, <code>CommandTimeout</code> will apply to the entire time required to read all the result sets,
167-
so must be set to a sufficiently large value.</td>
168-
</tr>
169162
<tr>
170163
<td>Compress, Use Compression, UseCompression</td>
171164
<td>false</td>

src/MySqlConnector/MySqlClient/MySqlConnection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ internal async Task<CachedProcedure> GetCachedProcedure(IOBehavior ioBehavior, s
314314

315315
internal MySqlTransaction CurrentTransaction { get; set; }
316316
internal bool AllowUserVariables => m_connectionSettings.AllowUserVariables;
317-
internal bool BufferResultSets => m_connectionSettings.BufferResultSets;
318317
internal bool ConvertZeroDateTime => m_connectionSettings.ConvertZeroDateTime;
319318
internal int DefaultCommandTimeout => m_connectionSettings.DefaultCommandTimeout;
320319
internal bool OldGuids => m_connectionSettings.OldGuids;

src/MySqlConnector/MySqlClient/MySqlConnectionStringBuilder.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ public bool AutoEnlist
128128
set => MySqlConnectionStringOption.AutoEnlist.SetValue(this, value);
129129
}
130130

131-
public bool BufferResultSets
132-
{
133-
get => MySqlConnectionStringOption.BufferResultSets.GetValue(this);
134-
set => MySqlConnectionStringOption.BufferResultSets.SetValue(this, value);
135-
}
136-
137131
public string CharacterSet
138132
{
139133
get => MySqlConnectionStringOption.CharacterSet.GetValue(this);
@@ -276,7 +270,6 @@ internal abstract class MySqlConnectionStringOption
276270
public static readonly MySqlConnectionStringOption<bool> AllowPublicKeyRetrieval;
277271
public static readonly MySqlConnectionStringOption<bool> AllowUserVariables;
278272
public static readonly MySqlConnectionStringOption<bool> AutoEnlist;
279-
public static readonly MySqlConnectionStringOption<bool> BufferResultSets;
280273
public static readonly MySqlConnectionStringOption<string> CharacterSet;
281274
public static readonly MySqlConnectionStringOption<uint> ConnectionTimeout;
282275
public static readonly MySqlConnectionStringOption<bool> ConvertZeroDateTime;
@@ -392,10 +385,6 @@ static MySqlConnectionStringOption()
392385
keys: new[] { "AutoEnlist", "Auto Enlist" },
393386
defaultValue: true));
394387

395-
AddOption(BufferResultSets = new MySqlConnectionStringOption<bool>(
396-
keys: new[] { "BufferResultSets", "Buffer Result Sets" },
397-
defaultValue: false));
398-
399388
AddOption(CharacterSet = new MySqlConnectionStringOption<string>(
400389
keys: new[] { "CharSet", "Character Set", "CharacterSet" },
401390
defaultValue: ""));

src/MySqlConnector/MySqlClient/MySqlDataReader.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -278,24 +278,14 @@ internal static async Task<MySqlDataReader> CreateAsync(MySqlCommand command, Co
278278
try
279279
{
280280
await dataReader.ReadFirstResultSetAsync(ioBehavior).ConfigureAwait(false);
281-
if (command.Connection.BufferResultSets)
282-
{
283-
while (await dataReader.BufferNextResultAsync(ioBehavior, CancellationToken.None).ConfigureAwait(false) != null)
284-
{
285-
}
286-
}
287-
return dataReader;
288281
}
289282
catch (Exception)
290283
{
291284
dataReader.Dispose();
292285
throw;
293286
}
294-
finally
295-
{
296-
if (command.Connection.BufferResultSets)
297-
command.Connection.FinishQuerying();
298-
}
287+
288+
return dataReader;
299289
}
300290

301291
internal async Task ReadFirstResultSetAsync(IOBehavior ioBehavior)
@@ -426,8 +416,7 @@ private void DoClose()
426416
m_nextResultSetBuffer.Clear();
427417

428418
var connection = Command.Connection;
429-
if (!connection.BufferResultSets)
430-
connection.FinishQuerying();
419+
connection.FinishQuerying();
431420

432421
Command.ReaderClosed();
433422
if ((m_behavior & CommandBehavior.CloseConnection) != 0)

src/MySqlConnector/Serialization/ConnectionSettings.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using MySql.Data.MySqlClient;
@@ -49,7 +49,6 @@ public ConnectionSettings(MySqlConnectionStringBuilder csb)
4949
AllowPublicKeyRetrieval = csb.AllowPublicKeyRetrieval;
5050
AllowUserVariables = csb.AllowUserVariables;
5151
AutoEnlist = csb.AutoEnlist;
52-
BufferResultSets = csb.BufferResultSets;
5352
ConnectionTimeout = (int)csb.ConnectionTimeout;
5453
ConvertZeroDateTime = csb.ConvertZeroDateTime;
5554
DefaultCommandTimeout = (int) csb.DefaultCommandTimeout;
@@ -91,7 +90,6 @@ public ConnectionSettings(MySqlConnectionStringBuilder csb)
9190
public bool AllowPublicKeyRetrieval { get; }
9291
public bool AllowUserVariables { get; }
9392
public bool AutoEnlist { get; }
94-
public bool BufferResultSets { get; }
9593
public int ConnectionTimeout { get; }
9694
public bool ConvertZeroDateTime { get; }
9795
public int DefaultCommandTimeout { get; }

tests/MySqlConnector.Tests/MySqlConnectionStringBuilderTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using MySql.Data.MySqlClient;
33
using Xunit;
44

@@ -29,7 +29,6 @@ public void Defaults()
2929
Assert.Equal("", csb.Database);
3030
Assert.Equal(30u, csb.DefaultCommandTimeout);
3131
#if !BASELINE
32-
Assert.False(csb.BufferResultSets);
3332
Assert.Equal(180u, csb.ConnectionIdleTimeout);
3433
Assert.False(csb.ForceSynchronous);
3534
Assert.Null(csb.CACertificateFile);
@@ -77,7 +76,6 @@ public void ParseConnectionString()
7776
"default command timeout=123;" +
7877
#if !BASELINE
7978
"connectionidletimeout=30;" +
80-
"bufferresultsets=true;" +
8179
"forcesynchronous=true;" +
8280
"ca certificate file=ca.pem;" +
8381
"allow public key retrieval = true;" +
@@ -108,7 +106,6 @@ public void ParseConnectionString()
108106
Assert.Equal("schema_name", csb.Database);
109107
Assert.Equal(123u, csb.DefaultCommandTimeout);
110108
#if !BASELINE
111-
Assert.True(csb.BufferResultSets);
112109
Assert.Equal(30u, csb.ConnectionIdleTimeout);
113110
Assert.True(csb.ForceSynchronous);
114111
Assert.Equal("ca.pem", csb.CACertificateFile);

tests/SideBySide/CancelTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void CancelCommand()
5454
}
5555
}
5656

57-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
57+
[Fact]
5858
public void CancelReaderAsynchronously()
5959
{
6060
using (var barrier = new Barrier(2))
@@ -90,7 +90,7 @@ public void CancelReaderAsynchronously()
9090
}
9191
}
9292

93-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
93+
[Fact]
9494
public void CancelCommandBeforeRead()
9595
{
9696
using (var cmd = new MySqlCommand(c_hugeQuery, m_database.Connection))
@@ -117,7 +117,7 @@ public void CancelCommandBeforeRead()
117117
}
118118
}
119119

120-
[SkippableFact(ConfigSettings.UnbufferedResultSets, Baseline = "Hangs in NextResult")]
120+
[SkippableFact(Baseline = "Hangs in NextResult")]
121121
public void CancelMultiStatementReader()
122122
{
123123
using (var barrier = new Barrier(2))
@@ -155,7 +155,7 @@ public void CancelMultiStatementReader()
155155
}
156156
}
157157

158-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
158+
[Fact]
159159
public void DapperQueryMultiple()
160160
{
161161
Stopwatch stopwatch;
@@ -271,7 +271,7 @@ public void ImplicitCancelWithDapper()
271271
Assert.Equal("value", value);
272272
}
273273

274-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
274+
[Fact]
275275
public async Task CancelHugeQueryWithTokenAfterExecuteReader()
276276
{
277277
using (var cmd = new MySqlCommand(c_hugeQuery, m_database.Connection))
@@ -297,7 +297,7 @@ public async Task CancelHugeQueryWithTokenAfterExecuteReader()
297297
}
298298
}
299299

300-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
300+
[Fact]
301301
public async Task CancelHugeQueryWithTokenInNextResult()
302302
{
303303
using (var cmd = new MySqlCommand(c_hugeQuery + "select 1, 2, 3;", m_database.Connection))
@@ -326,7 +326,7 @@ public async Task CancelHugeQueryWithTokenInNextResult()
326326
}
327327
}
328328

329-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
329+
[Fact]
330330
public async Task CancelSlowQueryWithTokenAfterExecuteReader()
331331
{
332332
using (var cmd = new MySqlCommand(c_slowQuery, m_database.Connection))
@@ -355,7 +355,7 @@ public async Task CancelSlowQueryWithTokenAfterExecuteReader()
355355
}
356356
}
357357

358-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
358+
[Fact]
359359
public async Task CancelSlowQueryWithTokenAfterNextResult()
360360
{
361361
using (var cmd = new MySqlCommand("SELECT 1; " + c_slowQuery, m_database.Connection))
@@ -391,7 +391,7 @@ public async Task CancelSlowQueryWithTokenAfterNextResult()
391391
}
392392
}
393393

394-
[SkippableFact(ConfigSettings.UnbufferedResultSets)]
394+
[Fact]
395395
public async Task CancelMultiStatementInRead()
396396
{
397397
using (var cmd = new MySqlCommand(c_hugeQuery + c_hugeQuery + c_hugeQuery, m_database.Connection))

tests/SideBySide/CommandTimeoutTests.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,8 @@ public void MultipleCommandTimeoutWithSleepSync()
135135
Assert.False(reader.Read());
136136
readFirstResultSet = true;
137137

138-
#if !BASELINE
139-
// if not buffering, the following call to a public API resets the internal timer
140-
if (!csb.BufferResultSets)
141-
#endif
142-
sw.Restart();
138+
// the following call to a public API resets the internal timer
139+
sw.Restart();
143140

144141
reader.NextResult();
145142

@@ -180,11 +177,8 @@ public async Task MultipleCommandTimeoutWithSleepAsync()
180177
Assert.False(await reader.ReadAsync());
181178
readFirstResultSet = true;
182179

183-
#if !BASELINE
184-
// if not buffering, the following call to a public API resets the internal timer
185-
if (!csb.BufferResultSets)
186-
#endif
187-
sw.Restart();
180+
// the following call to a public API resets the internal timer
181+
sw.Restart();
188182

189183
await reader.NextResultAsync();
190184

@@ -206,7 +200,7 @@ public async Task MultipleCommandTimeoutWithSleepAsync()
206200
#endif
207201
}
208202

209-
[SkippableFact(ConfigSettings.UnbufferedResultSets, Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
203+
[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
210204
public void CommandTimeoutResetsOnReadSync()
211205
{
212206
var csb = new MySqlConnectionStringBuilder(m_connection.ConnectionString);
@@ -228,7 +222,7 @@ public void CommandTimeoutResetsOnReadSync()
228222
Assert.Equal(ConnectionState.Open, m_connection.State);
229223
}
230224

231-
[SkippableFact(ConfigSettings.UnbufferedResultSets, Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
225+
[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
232226
public async Task CommandTimeoutResetsOnReadAsync()
233227
{
234228
var csb = new MySqlConnectionStringBuilder(m_connection.ConnectionString);

0 commit comments

Comments
 (0)