Issue #3154: Remove stats reclaimSpace call

Change-Id: I32fb957e236f257e5d8164833d2d2c1adf1fa639

Former-commit-id: a661a16f01 [formerly a077fd9cc6] [formerly fae9e811fb] [formerly 5648e27bbc [formerly fae9e811fb [formerly 4e35d1fa5e3e1ebaa5d177d95a5eb11741ae57d2]]]
Former-commit-id: 5648e27bbc
Former-commit-id: f56db3df561a3729a49b418c7643ed5a2924b76f [formerly f53d5ba7e9]
Former-commit-id: 87bb7ac342
This commit is contained in:
Richard Peter 2014-05-12 12:27:23 -05:00
parent cf491026b0
commit e7d80f7c67
2 changed files with 2 additions and 33 deletions

View file

@ -79,6 +79,7 @@ import com.raytheon.uf.edex.stats.util.ConfigLoader;
* May 22, 2013 1917 rjpeter Added ability to save raw and aggregate stats, to reclaimSpace every scan call, * May 22, 2013 1917 rjpeter Added ability to save raw and aggregate stats, to reclaimSpace every scan call,
* and to not pretty print xml grouping information. * and to not pretty print xml grouping information.
* Apr 18, 2014 2681 rjpeter Updated scan to process in distinct chunks of time. * Apr 18, 2014 2681 rjpeter Updated scan to process in distinct chunks of time.
* May 12, 2014 3154 rjpeter Removed reclaimSpace call.
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -305,7 +306,6 @@ public class AggregateManager {
} }
} }
statsRecordDao.reclaimSpace();
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
statusHandler.info("Aggregated " + count + " stat events in " statusHandler.info("Aggregated " + count + " stat events in "
+ (t1 - t0) + " ms"); + (t1 - t0) + " ms");

View file

@ -23,9 +23,6 @@ package com.raytheon.uf.edex.stats.dao;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import org.hibernate.Query;
import org.hibernate.StatelessSession;
import com.raytheon.uf.common.stats.StatsRecord; import com.raytheon.uf.common.stats.StatsRecord;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.dao.SessionManagedDao; import com.raytheon.uf.edex.database.dao.SessionManagedDao;
@ -43,6 +40,7 @@ import com.raytheon.uf.edex.database.dao.SessionManagedDao;
* Mar 18, 2013 1082 bphillip Modified to extend sessionmanagedDao and use spring injection * Mar 18, 2013 1082 bphillip Modified to extend sessionmanagedDao and use spring injection
* May 22, 2013 1917 rjpeter Added reclaimSpace. * May 22, 2013 1917 rjpeter Added reclaimSpace.
* Apr 18, 2014 2681 rjpeter Added retrieveMinTime. * Apr 18, 2014 2681 rjpeter Added retrieveMinTime.
* May 12, 2014 3154 rjpeter Remove reclaimSpace, postgres 9.2 autovacuum sufficient.
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -105,33 +103,4 @@ public class StatsDao extends SessionManagedDao<Integer, StatsRecord> {
protected Class<StatsRecord> getEntityClass() { protected Class<StatsRecord> getEntityClass() {
return StatsRecord.class; return StatsRecord.class;
} }
/**
* Manually runs vacuum due to large numbers of inserts and deletes to keep
* table size to a minimum.
*/
public void reclaimSpace() {
StatelessSession sess = null;
try {
sess = template.getSessionFactory().openStatelessSession();
// vacuum can't run within a transaction, hack to allow vacuum to
// run from within hibernate
Query query = sess.createSQLQuery("rollback; VACUUM events.stats");
query.executeUpdate();
statusHandler.info("stats vacuumed");
} catch (Exception e) {
statusHandler.error(
"Error occurred running VACUUM on events.stats", e);
} finally {
if (sess != null) {
try {
sess.close();
} catch (Exception e) {
statusHandler.error(
"Error occurred closing database session", e);
}
}
}
}
} }