List:Commits« Previous MessageNext Message »
From:mmatthews Date:June 15 2006 9:58pm
Subject:Connector/J commit: r5392 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_3_1/connector-j/src/com/mysql/jdbc/pr...
View as plain text  
Modified:
   branches/branch_3_1/connector-j/CHANGES
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/Connection.java
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_1/connector-j/CHANGES
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java
Log:
Fixed BUG#16987 - Memory leak with profileSQL=true.

Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES	2006-06-15 19:46:05 UTC (rev 5391)
+++ branches/branch_3_1/connector-j/CHANGES	2006-06-15 19:58:39 UTC (rev 5392)
@@ -9,6 +9,8 @@
 	- Fixed BUG#20485 - Updatable result set that contains
 	  a BIT column fails when server-side prepared statements are used.
 	  
+	- Fixed BUG#16987 - Memory leak with profileSQL=true.
+	  
 05-26-06 - Version 3.1.13
 
     - Fixed BUG#15464 - INOUT parameter does not store IN value.

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/Connection.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/Connection.java	2006-06-15 19:46:05
UTC (rev 5391)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/Connection.java	2006-06-15 19:58:39
UTC (rev 5392)
@@ -4484,6 +4484,7 @@
 		} finally {
 			this.openStatements = null;
 			this.io = null;
+			ProfileEventSink.removeInstance(this);
 			this.isClosed = true;
 		}
 

Modified:
branches/branch_3_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java
===================================================================
---
branches/branch_3_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java	2006-06-15
19:46:05 UTC (rev 5391)
+++
branches/branch_3_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java	2006-06-15
19:58:39 UTC (rev 5392)
@@ -62,6 +62,10 @@
 		return sink;
 	}
 
+	public static synchronized void removeInstance(Connection conn) {
+		CONNECTIONS_TO_SINKS.remove(conn);
+	}
+	
 	/**
 	 * Process a profiler event
 	 * 

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2006-06-15 19:46:05 UTC (rev 5391)
+++ branches/branch_5_0/connector-j/CHANGES	2006-06-15 19:58:39 UTC (rev 5392)
@@ -137,6 +137,8 @@
 	- Fixed BUG#20485 - Updatable result set that contains
 	  a BIT column fails when server-side prepared statements are used.
 	  
+	- Fixed BUG#16987 - Memory leak with profileSQL=true.
+	  
 05-26-06 - Version 3.1.13
 
     - Fixed BUG#15464 - INOUT parameter does not store IN value.

Modified: branches/branch_5_1/connector-j/CHANGES
===================================================================
--- branches/branch_5_1/connector-j/CHANGES	2006-06-15 19:46:05 UTC (rev 5391)
+++ branches/branch_5_1/connector-j/CHANGES	2006-06-15 19:58:39 UTC (rev 5392)
@@ -111,6 +111,8 @@
 	- Fixed BUG#20485 - Updatable result set that contains
 	  a BIT column fails when server-side prepared statements are used.
 	  
+	- Fixed BUG#16987 - Memory leak with profileSQL=true.
+	  
 05-26-06 - Version 3.1.13
 
     - Fixed BUG#15464 - INOUT parameter does not store IN value.

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java	2006-06-15 19:46:05
UTC (rev 5391)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java	2006-06-15 19:58:39
UTC (rev 5392)
@@ -935,6 +935,8 @@
 		if (versionMeetsMinimum(4, 1, 0)) {
 			configureClientCharacterSet();
 		}
+		
+		setupServerForTruncationChecks();
 	}
 
 	private void checkAndCreatePerformanceHistogram() {
@@ -3150,8 +3152,44 @@
 				setAllowMultiQueries(false);
 			}
 		}
+		
+		//
+		// Server can do this more efficiently for us
+		//
+		
+		setupServerForTruncationChecks();
 	}
 
+	private void setupServerForTruncationChecks() throws SQLException {
+		if (getJdbcCompliantTruncation()) {
+			if (versionMeetsMinimum(5, 0, 2)) {
+				String currentSqlMode = 
+					(String)this.serverVariables.get("sql_mode");
+				
+				if (currentSqlMode == null ||
+						currentSqlMode.length() == 0 ||
+						StringUtils.indexOfIgnoreCase(currentSqlMode, "STRICT_TRANS_TABLES") == -1) {
+					StringBuffer commandBuf = new StringBuffer("SET sql_mode='");
+					
+					if (currentSqlMode != null && currentSqlMode.length() > 0) {
+						commandBuf.append(currentSqlMode);
+						commandBuf.append(",");
+					}
+					
+					commandBuf.append("STRICT_TRANS_TABLES'");
+					
+					execSQL(null,  commandBuf.toString(), -1, null,
+							java.sql.ResultSet.TYPE_FORWARD_ONLY,
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
+							this.database, true, false);
+					
+					setJdbcCompliantTruncation(false); // server's handling this for us now
+				}
+				
+			}
+		}
+	}
+
 	protected boolean isClientTzUTC() {
 		return this.isClientTzUTC;
 	}
@@ -3721,6 +3759,7 @@
 		} finally {
 			this.openStatements = null;
 			this.io = null;
+			ProfileEventSink.removeInstance(this);
 			this.isClosed = true;
 		}
 

Modified:
branches/branch_5_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java
===================================================================
---
branches/branch_5_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java	2006-06-15
19:46:05 UTC (rev 5391)
+++
branches/branch_5_1/connector-j/src/com/mysql/jdbc/profiler/ProfileEventSink.java	2006-06-15
19:58:39 UTC (rev 5392)
@@ -62,6 +62,10 @@
 		return sink;
 	}
 
+	public static synchronized void removeInstance(Connection conn) {
+		CONNECTIONS_TO_SINKS.remove(conn);
+	}
+	
 	/**
 	 * Process a profiler event
 	 * 

Thread
Connector/J commit: r5392 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_3_1/connector-j/src/com/mysql/jdbc/pr...mmatthews15 Jun