Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Connector/NET commit: r1048 - in branches/5.0: . Driver/Source

From: <rburnett(at)mysql.com>
Date: Wed Oct 31 2007 - 17:26:19 EDT


Modified:

   branches/5.0/CHANGES
   branches/5.0/Driver/Source/MySqlStream.cs
   branches/5.0/Driver/Source/NativeDriver.cs
Log:
sped up LOAD DATA LOCAL INFILE dramatically by bypassing the normal stream processing code in MySqlStream

Modified: branches/5.0/CHANGES


  • branches/5.0/CHANGES 2007-10-25 19:40:48 UTC (rev 1047) +++ branches/5.0/CHANGES 2007-10-31 21:26:19 UTC (rev 1048) @@ -18,6 +18,7 @@ using case insensitive semantics and this causes cases where a user orginally used the wrong case for a user id and then fixed it to still get access denied errors. (Bug #31433) + - improved the speed of load data local infile significantly

 Version 5.0.8 8/16/2007  

Modified: branches/5.0/Driver/Source/MySqlStream.cs


  • branches/5.0/Driver/Source/MySqlStream.cs 2007-10-25 19:40:48 UTC (rev 1047) +++ branches/5.0/Driver/Source/MySqlStream.cs 2007-10-31 21:26:19 UTC (rev 1048) @@ -213,6 +213,15 @@ } }
+        public void SendEntirePacketDirectly(byte[] buffer, int count)
+        {
+            buffer[0] = (byte)(count & 0xff);
+            buffer[1] = (byte)((count >> 8) & 0xff);
+            buffer[2] = (byte)((count >> 16) & 0xff);
+            buffer[3] = sequenceByte++;
+            baseStream.Write(buffer, 0, count + 4);
+        }
+
 		/// 
 		/// StartOutput is used to reset the write state of the stream.
 		/// 

Modified: branches/5.0/Driver/Source/NativeDriver.cs


  • branches/5.0/Driver/Source/NativeDriver.cs 2007-10-25 19:40:48 UTC (rev 1047) +++ branches/5.0/Driver/Source/NativeDriver.cs 2007-10-31 21:26:19 UTC (rev 1048) @@ -563,25 +563,21 @@ /// <param name="filename"></param> private void SendFileToServer(string filename) { - byte[] buffer = new byte[4092]; + byte[] buffer = new byte[8196]; FileStream fs = null;
+            long len = 0;
 			try
 			{
 				fs = new FileStream(filename, FileMode.Open);
-				stream.StartOutput((ulong)fs.Length, false);
-
-				long len = fs.Length;
+				len = fs.Length;
 				while (len > 0)
 				{
-					int count = fs.Read(buffer, 0, 4092);
-					stream.Write(buffer, 0, count);
+					int count = fs.Read(buffer, 4, (int)(len > 8192 ? 8192 : len));
+                    stream.SendEntirePacketDirectly(buffer, count);
 					len -= count;
 				}
-
-				// write the terminating packet
-				stream.SendEmptyPacket();
-				stream.Flush();
+                stream.SendEntirePacketDirectly(buffer, 0);
 			}
 			catch (Exception ex)
 			{
-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Wed Oct 31 17:26:22 2007

This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 11:15:02 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library