IDEMPIERE-6123 Query in search window causing slowness and load spikes in the database (FHCA-5356) (#2408)
fix new issue found informing timeout errors when no records are found after a failed count
This commit is contained in:
parent
b118283530
commit
6192a8fff8
|
|
@ -98,7 +98,7 @@ public class GridTable extends AbstractTableModel
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2602189278069194311L;
|
private static final long serialVersionUID = 3948220810042370826L;
|
||||||
|
|
||||||
protected static final String SORTED_DSE_EVENT = "Sorted";
|
protected static final String SORTED_DSE_EVENT = "Sorted";
|
||||||
|
|
||||||
|
|
@ -172,6 +172,7 @@ public class GridTable extends AbstractTableModel
|
||||||
/** Rowcount */
|
/** Rowcount */
|
||||||
private int m_rowCount = 0;
|
private int m_rowCount = 0;
|
||||||
private boolean m_rowCountTimeout = false;
|
private boolean m_rowCountTimeout = false;
|
||||||
|
private boolean m_rowLoadTimeout = false;
|
||||||
/** Has Data changed? */
|
/** Has Data changed? */
|
||||||
private boolean m_changed = false;
|
private boolean m_changed = false;
|
||||||
/** Index of changed row via SetValueAt */
|
/** Index of changed row via SetValueAt */
|
||||||
|
|
@ -1160,6 +1161,9 @@ public class GridTable extends AbstractTableModel
|
||||||
if (savedEx != null)
|
if (savedEx != null)
|
||||||
throw new IllegalStateException(savedEx);
|
throw new IllegalStateException(savedEx);
|
||||||
}
|
}
|
||||||
|
// zero rows found without load timeout
|
||||||
|
if (row == 0 && m_sort.size() == 0 && m_rowCountTimeout && !m_rowLoadTimeout)
|
||||||
|
throw new AdempiereException(Msg.getMsg(Env.getCtx(), "FindZeroRecords"));
|
||||||
if (row >= m_sort.size()) {
|
if (row >= m_sort.size()) {
|
||||||
log.warning("Reached " + timeout + " seconds timeout loading row " + (row+1) + " for SQL=" + m_SQL);
|
log.warning("Reached " + timeout + " seconds timeout loading row " + (row+1) + " for SQL=" + m_SQL);
|
||||||
//adjust row count
|
//adjust row count
|
||||||
|
|
@ -1268,6 +1272,7 @@ public class GridTable extends AbstractTableModel
|
||||||
|
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
m_rowLoadTimeout = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stmt = DB.prepareStatement(sql.toString(), null);
|
stmt = DB.prepareStatement(sql.toString(), null);
|
||||||
|
|
@ -1305,6 +1310,8 @@ public class GridTable extends AbstractTableModel
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
|
if (DB.getDatabase().isQueryTimeout(e))
|
||||||
|
m_rowLoadTimeout = true;
|
||||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue