/** * This calls optimize on the optimizer. * <p> * @see java.lang.Runnable#run() */ @Override public void run() { if ( optimizer != null ) { boolean success = optimizer.optimizeTable(); if ( log.isInfoEnabled() ) { log.info( "Optimization success status [" + success + "]" ); } } else { log.warn( "OptimizerRunner: The optimizer is null. Could not optimize table." ); } } }
ResultSet repairResult = sStatement.executeQuery( "repair table " + this.getTableName() ); StringBuilder repairString = new StringBuilder(); int numColumns = repairResult.getMetaData().getColumnCount();
/** * This constructs an optimizer with the disk cacn properties. * <p> * @param attributes * @param tableState We mark the table status as optimizing when this is happening. * @param dataSource access to the database */ public MySQLTableOptimizer( MySQLDiskCacheAttributes attributes, TableState tableState, DataSource dataSource ) { setTableName( attributes.getTableName() ); this.tableState = tableState; this.dataSource = dataSource; }
/** * Run the optimization against live a table. * <p> * @throws Exception */ public void testBasicOptimization() throws Exception { // SETUP MySQLDiskCacheAttributes attributes = new MySQLDiskCacheAttributes(); attributes.setUserName( "java" ); attributes.setPassword( "letmein" ); attributes.setUrl( "jdbc:mysql://10.19.98.43:3306/flight_option_cache" ); attributes.setDriverClassName( "com.mysql.jdbc.Driver" ); String tableName = "JCS_STORE_FLIGHT_OPTION_ITINERARY"; attributes.setTableName( tableName ); TableState tableState = new TableState( tableName ); MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState, JDBCDiskCachePoolAccessManager .createPoolAccess( attributes ) ); // DO WORK optimizer.optimizeTable(); }
if ( log.isInfoEnabled() ) log.info( "Optimizing table [" + this.getTableName() + "]" ); ResultSet rs = sStatement.executeQuery( "optimize table " + this.getTableName() ); success = repairTable( sStatement ); String statusString = getTableStatus( sStatement ); if ( log.isInfoEnabled() ) log.info( "Table status after optimizing table [" + this.getTableName() + "]\n" + statusString ); log.error( "Problem optimizing table [" + this.getTableName() + "]", e ); return false; if ( log.isInfoEnabled() ) log.info( "Optimization of table [" + this.getTableName() + "] took " + ( end - start ) + " ms." );
MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState, ds );
/** * Run the optimization against live a table. * <p> * @throws Exception */ public void testBasicOptimizationUnknownTable() throws Exception { // SETUP MySQLDiskCacheAttributes attributes = new MySQLDiskCacheAttributes(); attributes.setUserName( "java" ); attributes.setPassword( "letmein" ); attributes.setUrl( "jdbc:mysql://10.19.98.43:3306/flight_option_cache" ); attributes.setDriverClassName( "com.mysql.jdbc.Driver" ); String tableName = "DOESNTEXIST"; attributes.setTableName( tableName ); TableState tableState = new TableState( tableName ); MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState, JDBCDiskCachePoolAccessManager .createPoolAccess( attributes ) ); // DO WORK optimizer.optimizeTable(); } }
if ( log.isInfoEnabled() ) log.info( "Optimizing table [" + this.getTableName() + "]" ); ResultSet rs = sStatement.executeQuery( "optimize table " + this.getTableName() ); success = repairTable( sStatement ); String statusString = getTableStatus( sStatement ); if ( log.isInfoEnabled() ) log.info( "Table status after optimizing table [" + this.getTableName() + "]\n" + statusString ); log.error( "Problem optimizing table [" + this.getTableName() + "]", e ); return false; if ( log.isInfoEnabled() ) log.info( "Optimization of table [" + this.getTableName() + "] took " + ( end - start ) + " ms." );
MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState, poolAccess );
/** * This calls optimize on the optimizer. * <p> * @see java.lang.Runnable#run() */ @Override public void run() { if ( optimizer != null ) { boolean success = optimizer.optimizeTable(); if ( log.isInfoEnabled() ) { log.info( "Optimization success status [" + success + "]" ); } } else { log.warn( "OptimizerRunner: The optimizer is null. Could not optimize table." ); } } }
/** * This constructs an optimizer with the disk cacn properties. * <p> * @param attributes * @param tableState We mark the table status as optimizing when this is happening. * @param poolAccess access to the database */ public MySQLTableOptimizer( MySQLDiskCacheAttributes attributes, TableState tableState, JDBCDiskCachePoolAccess poolAccess ) { setTableName( attributes.getTableName() ); this.tableState = tableState; this.poolAccess = poolAccess; }
ResultSet repairResult = sStatement.executeQuery( "repair table " + this.getTableName() ); StringBuilder repairString = new StringBuilder(); int numColumns = repairResult.getMetaData().getColumnCount();