Bug #34270 useCompression=true and LOAD DATA LOCAL INFILE SQL Command
Submitted: 4 Feb 2008 9:49 Modified: 7 Mar 2008 23:03
Reporter: Damien Gerard Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.1.22-rc OS:Windows
Assigned to: CPU Architecture:Any

[4 Feb 2008 9:49] Damien Gerard
Description:
When I use the property useCompression=true in conjunction with SQL-Command  "LOAD DATA LOCAL INFILE ..." I get a socket SocketException: Broken pipe.
I connect from a local client to a remote Mysql server and I try to load huge file (~300Mo).
When UseCompression is turned off everything works fine.
Note that this problem does not occur with small file.

How to repeat:
Here a simple test case:

MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "Server=xxx; Username=xx; Password=xx; database=xx; Port=3306; Default Command Timeout=360;";
conn.UseCompression = true;
conn.Open();
String myInsertQuery = "LOAD DATA LOCAL INFILE 'Data/hugefile.txt' REPLACE INTO TABLE `" +
tablename + "` FIELDS TERMINATED BY '|' ENCLOSED BY '' LINES TERMINATED BY '" +
Environment.NewLine + "'";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery, conn);
myCommand.ExecuteNonQuery();
conn.Close();
[4 Feb 2008 12:10] Tonci Grgin
Hi Damien and thanks for your report. Does this happen from mysql cl client too? If not, please add c/NET and .NET fw used and a small table dump which I can use to verify the problem.
[4 Feb 2008 14:46] Damien Gerard
Hi Tonci,

After some tests it seems to work with mysqlimport command line.

I use .Net Framework 2.0 with mysql-connector version 5.1.4.
[5 Feb 2008 12:35] Tonci Grgin
Damien, I will test this now but I'd still like to know what does "After some tests it seems to work with mysqlimport command line." mean? Is it working with --compress or not?
[5 Feb 2008 12:39] Damien Gerard
Oh yeah sorry misunderstood. Yes command line works well with --compress option.
[5 Feb 2008 17:49] Tonci Grgin
Hi Damien and thanks for a good report. I was able to verify the problem using following environment:
 - client: WinXP Pro SP2, .NET fw 2 SP1. c/NET 5.1.4GA and latest sources from trunk
 - server: WinXP Pro SP2 in VM, MySQL server 5.0.54BK and 5.1.23BK

Many functions in CompressedStream.cs have "impossible" values to work with like on LN 160, private void ReadNextPacket(int len), where test spends most of it's time, where inBuffer is huge and zero-filled causing read variable never to increment... Setting "Use compression" to FALSE corrects the problem.

Test case:
    MySqlConnection conn = new MySqlConnection();
    conn.ConnectionString = "DataSource=tong1;Database=test;UserID=root;Password=;use compression=true";
    conn.Open();
    String myInsertQuery = "LOAD DATA LOCAL INFILE 'c:/dmp.sql' INTO TABLE `t_devices_prf`";
    MySqlCommand myCommand = new MySqlCommand(myInsertQuery, conn);
    myCommand.ExecuteNonQuery();
    conn.Close();
//Use any table/data file available.
[7 Mar 2008 23:03] Reggie Burnett
This is fixed in the current source tree.  This might have been solved by the fix for bug #27865 since that was the only code worked on that is related to compression.