Skip to content

Commit eff8fd8

Browse files
committed
Merge 0.69.3 into master.
2 parents 1eb4f1c + ff5d594 commit eff8fd8

File tree

4 files changed

+31
-27
lines changed

4 files changed

+31
-27
lines changed

docs/content/overview/version-history.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Version History
2020
* Add `net5.0` target framework.
2121
* Reduce memory allocations when hashing passwords (during login).
2222

23+
### 0.69.3
24+
25+
* Fix `Failed to read the result set.` error when using `MySqlBulkCopy`: [#780](https://github.com/mysql-net/MySqlConnector/issues/780).
26+
* The maximum row size supported by `MySqlBulkCopy`is 1 MiB.
27+
2328
### 0.69.2
2429

2530
* Remove `Console.WriteLine` debugging code that was inadvertently added in 0.69.1.

src/MySqlConnector/MySqlBulkCopy.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ static void AddColumnMapping(List<MySqlBulkCopyColumnMapping> columnMappings, bo
351351

352352
internal async Task SendDataReaderAsync(IOBehavior ioBehavior, CancellationToken cancellationToken)
353353
{
354-
// rent a buffer that can fit in one packet
355-
const int maxLength = 16_777_200;
354+
const int maxLength = 1048575;
356355
var buffer = ArrayPool<byte>.Shared.Rent(maxLength + 1);
357356
var outputIndex = 0;
358357

@@ -396,7 +395,7 @@ await m_valuesEnumerator.MoveNextAsync().ConfigureAwait(false) :
396395
if (!wroteRow)
397396
{
398397
if (startOutputIndex == 0)
399-
throw new NotSupportedException("Total row length must be less than 16MiB.");
398+
throw new NotSupportedException("Total row length must be less than 1 MiB.");
400399
var payload = new PayloadData(new ArraySegment<byte>(buffer, 0, startOutputIndex));
401400
await m_connection.Session.SendReplyAsync(payload, ioBehavior, cancellationToken).ConfigureAwait(false);
402401
outputIndex = 0;

tests/SideBySide/BulkLoaderAsync.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ public async Task BulkLoadLocalMemoryStream()
400400
}
401401

402402
[Fact]
403-
public async Task BulkLoadDataReader()
403+
public async Task BulkCopyDataReader()
404404
{
405405
using var connection = new MySqlConnection(GetLocalConnectionString());
406406
using var connection2 = new MySqlConnection(GetLocalConnectionString());
@@ -446,7 +446,7 @@ public void BulkCopyNullDataTable()
446446
}
447447

448448
[Fact]
449-
public async Task BulkLoadDataTableWithLongData()
449+
public async Task BulkCopyDataTableWithLongData()
450450
{
451451
var dataTable = new DataTable()
452452
{
@@ -457,8 +457,8 @@ public async Task BulkLoadDataTableWithLongData()
457457
},
458458
Rows =
459459
{
460-
new object[] { 1, new byte[8388500] },
461-
new object[] { 12345678, new byte[8388500] },
460+
new object[] { 1, new byte[524200] },
461+
new object[] { 12345678, new byte[524200] },
462462
},
463463
};
464464

@@ -478,7 +478,7 @@ public async Task BulkLoadDataTableWithLongData()
478478
}
479479

480480
[Fact]
481-
public async Task BulkLoadDataTableWithTooLongData()
481+
public async Task BulkCopyDataTableWithTooLongData()
482482
{
483483
var dataTable = new DataTable()
484484
{
@@ -488,7 +488,7 @@ public async Task BulkLoadDataTableWithTooLongData()
488488
},
489489
Rows =
490490
{
491-
new object[] { new byte[8388700] },
491+
new object[] { new byte[524300] },
492492
}
493493
};
494494

@@ -594,7 +594,7 @@ public async Task BulkCopyAbort(int notifyAfter, int rowCount, int abortAfter, i
594594
{
595595
Columns = { new DataColumn("value", typeof(string)) },
596596
};
597-
var str = new string('a', 1_000_000);
597+
var str = new string('a', 62500);
598598
foreach (var x in Enumerable.Range(1, rowCount))
599599
dataTable.Rows.Add(new object[] { str });
600600

tests/SideBySide/BulkLoaderSync.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ public void BulkLoadLocalMemoryStream()
481481
}
482482

483483
[Fact]
484-
public void BulkLoadDataReader()
484+
public void BulkCopyDataReader()
485485
{
486486
using var connection = new MySqlConnection(GetLocalConnectionString());
487487
using var connection2 = new MySqlConnection(GetLocalConnectionString());
@@ -526,8 +526,8 @@ public void BulkCopyNullDataTable()
526526
Assert.Throws<ArgumentNullException>(() => bulkCopy.WriteToServer(default(DataTable)));
527527
}
528528

529-
[SkippableFact(ServerFeatures.LargePackets)]
530-
public void BulkLoadDataTableWithLongBlob()
529+
[Fact]
530+
public void BulkCopyDataTableWithLongBlob()
531531
{
532532
var dataTable = new DataTable()
533533
{
@@ -538,8 +538,8 @@ public void BulkLoadDataTableWithLongBlob()
538538
},
539539
Rows =
540540
{
541-
new object[] { 1, new byte[8388500] },
542-
new object[] { 12345678, new byte[8388500] },
541+
new object[] { 1, new byte[524200] },
542+
new object[] { 12345678, new byte[524200] },
543543
},
544544
};
545545

@@ -559,12 +559,12 @@ public void BulkLoadDataTableWithLongBlob()
559559

560560
using (var cmd = new MySqlCommand(@"select sum(length(b)) from bulk_load_data_table;", connection))
561561
{
562-
Assert.Equal(16_777_000m, cmd.ExecuteScalar());
562+
Assert.Equal(1_048_400m, cmd.ExecuteScalar());
563563
}
564564
}
565565

566-
[SkippableFact(ServerFeatures.LargePackets)]
567-
public void BulkLoadDataTableWithLongString()
566+
[Fact]
567+
public void BulkCopyDataTableWithLongString()
568568
{
569569
var dataTable = new DataTable()
570570
{
@@ -575,8 +575,8 @@ public void BulkLoadDataTableWithLongString()
575575
},
576576
Rows =
577577
{
578-
new object[] { 1, new string('a', 16_777_000) },
579-
new object[] { 2, new string('b', 16_777_000) },
578+
new object[] { 1, new string('a', 1_048_500) },
579+
new object[] { 2, new string('b', 1_048_500) },
580580
},
581581
};
582582

@@ -596,12 +596,12 @@ public void BulkLoadDataTableWithLongString()
596596

597597
using (var cmd = new MySqlCommand(@"select sum(length(b)) from bulk_load_data_table;", connection))
598598
{
599-
Assert.Equal(33_554_000m, cmd.ExecuteScalar());
599+
Assert.Equal(2_097_000m, cmd.ExecuteScalar());
600600
}
601601
}
602602

603603
[Fact]
604-
public void BulkLoadDataTableWithSpecialCharacters()
604+
public void BulkCopyDataTableWithSpecialCharacters()
605605
{
606606
var dataTable = new DataTable()
607607
{
@@ -644,7 +644,7 @@ public void BulkLoadDataTableWithSpecialCharacters()
644644
}
645645

646646
[Fact]
647-
public void BulkLoadDataTableWithTooLongBlob()
647+
public void BulkCopyDataTableWithTooLongBlob()
648648
{
649649
var dataTable = new DataTable()
650650
{
@@ -654,7 +654,7 @@ public void BulkLoadDataTableWithTooLongBlob()
654654
},
655655
Rows =
656656
{
657-
new object[] { new byte[8388700] },
657+
new object[] { new byte[524300] },
658658
}
659659
};
660660

@@ -674,7 +674,7 @@ public void BulkLoadDataTableWithTooLongBlob()
674674
}
675675

676676
[Fact]
677-
public void BulkLoadDataTableWithTooLongString()
677+
public void BulkCopyDataTableWithTooLongString()
678678
{
679679
var dataTable = new DataTable()
680680
{
@@ -684,7 +684,7 @@ public void BulkLoadDataTableWithTooLongString()
684684
},
685685
Rows =
686686
{
687-
new object[] { new string('a', 16_777_400) },
687+
new object[] { new string('a', 1_048_700) },
688688
}
689689
};
690690

@@ -779,7 +779,7 @@ public void BulkCopyAbort(int notifyAfter, int rowCount, int abortAfter, int exp
779779
{
780780
Columns = { new DataColumn("value", typeof(string)) },
781781
};
782-
var str = new string('a', 1_000_000);
782+
var str = new string('a', 62500);
783783
foreach (var x in Enumerable.Range(1, rowCount))
784784
dataTable.Rows.Add(new object[] { str });
785785

0 commit comments

Comments
 (0)