From: <hr...@rh...> - 2008-11-28 19:57:31
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [2132] RHQ-1005 use async commit for measurement data on Postgres 8.3+</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>2132</dd> <dt>Author</dt> <dd>hrupp</dd> <dt>Date</dt> <dd>2008-11-28 13:57:27 -0600 (Fri, 28 Nov 2008)</dd> </dl> <h3>Log Message</h3> <pre>RHQ-1005 use async commit for measurement data on Postgres 8.3+</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservermeasurementMeasurementDataManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseservermeasurementMeasurementDataManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java (2131 => 2132)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java 2008-11-28 19:26:26 UTC (rev 2131) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java 2008-11-28 19:57:27 UTC (rev 2132) </span><span class="lines">@@ -21,6 +21,7 @@ </span><span class="cx"> import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; </span><span class="add">+import java.sql.Statement; </span><span class="cx"> import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; </span><span class="lines">@@ -54,6 +55,7 @@ </span><span class="cx"> import org.rhq.core.db.DatabaseType; import org.rhq.core.db.DatabaseTypeFactory; </span><span class="add">+import org.rhq.core.db.Postgresql83DatabaseType; </span><span class="cx"> import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.DisplayType; </span><span class="lines">@@ -207,6 +209,7 @@ </span><span class="cx"> Connection conn = null; DatabaseType dbType = null; </span><span class="add">+ Statement st = null; </span><span class="cx"> Map<String, PreparedStatement> statements = new HashMap<String, PreparedStatement>(); </span><span class="lines">@@ -214,6 +217,13 @@ </span><span class="cx"> conn = rhqDs.getConnection(); dbType = DatabaseTypeFactory.getDatabaseType(conn); </span><span class="add">+ if (dbType instanceof Postgresql83DatabaseType) { + // Take advantage of async commit here + st = conn.createStatement(); + st.execute("SET synchronous_commit = off"); + st.close(); + } + </span><span class="cx"> for (MeasurementDataNumeric aData : data) { if (aData.getValue() == null || Double.isNaN(aData.getValue())) { expectedCount--; </span><span class="lines">@@ -270,6 +280,7 @@ </span><span class="cx"> JDBCUtil.safeClose(ps); } </span><span class="add">+ JDBCUtil.safeClose(st); </span><span class="cx"> JDBCUtil.safeClose(conn); } } </span> </pre> </div> </div> </body> </html> |