public class XplainStatisticsTest extends BaseJDBCTestCase
| Modifier and Type | Class and Description |
|---|---|
private static class |
XplainStatisticsTest.AbstractMTThread
Abstract class for a thread executing a database action (i.e. a query).
|
private static class |
XplainStatisticsTest.MTSimpleInvalidate
Thread for invalidating the COUNTRIES table in a loop.
|
private static class |
XplainStatisticsTest.MTSimpleSelect
Thread for selecting from the COUNTRIES table in a loop, with the XPLAIN-
functionality enabled.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String[] |
tableNames |
private static long |
timeSuiteStarted |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
XplainStatisticsTest(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
private static void |
clearXplainOnlyMode(java.sql.Statement s) |
private int |
countNode(java.lang.String file)
Added by DERBY-4587
count the # of <node> elements
|
private static void |
createSchemaObjects(java.sql.Statement st)
Creates a variety of tables used by the various tests.
|
private static void |
disableXplainStyle(java.sql.Statement s) |
private void |
dumpResultSets(java.sql.Statement s) |
private void |
dumpStatements(java.sql.Statement s) |
private static void |
enableXplainOnlyMode(java.sql.Statement s) |
private static void |
enableXplainStyle(java.sql.Statement s) |
private static void |
enableXplainStyleWithTiming(java.sql.Statement s) |
private java.lang.Object |
getADocument(java.lang.String file)
Added by DERBY-4587
|
private java.lang.String |
getNodeAttribute(java.lang.String file,
java.lang.String attribute,
int node)
Added by DERBY-4587
gets attributes other than "name"
|
private java.lang.String |
getNodeName(java.lang.String file)
Added by DERBY-4587
gets the "name" attributes of all nodes separated by a "|"
|
private long |
getNonNegativeLong(java.sql.ResultSet rs,
java.lang.String cName) |
private java.sql.Timestamp |
getNonNullTimestamp(java.sql.ResultSet rs,
java.lang.String cName) |
private java.lang.String |
getStmtID(java.sql.Statement s)
Added by DERBY-4587
Returns the stmt_id for this particular statement
|
private java.lang.String[] |
getStmtIDArray(java.sql.Statement s,
int length)
Added by DERBY-4587
Returns the stmt_id for this particular statement
|
private java.lang.String |
getStmtIDByName(java.sql.Statement s,
java.lang.String sName) |
private static boolean |
hasTable(java.sql.Statement s,
java.lang.String schemaName,
java.lang.String tableName) |
private java.lang.String |
readStatement(java.lang.String file)
Added by DERBY-4587
gets the <statement> element from the XML
|
protected void |
setUp() |
static junit.framework.Test |
suite() |
void |
testAggregationResultSet()
A simple test of an AGGREGATION result set.
|
void |
testAlwaysEmptyResultSet()
Test that run-time statistics are recorded even if the query has a
predicate that always evaluates to false.
|
void |
testConstraintScan()
Verify XPLAIN style handling of a CONSTRAINT scan.
|
void |
testDDLCreateTable()
A simple test of capturing statistics for a DDL statement.
|
void |
testDeleteResultSet()
A simple test of an DELETE result set.
|
void |
testDistinctAggregateSortProps()
Verify XPLAIN style handling of DISTINCT_AGGREGATE sort properties.
|
void |
testGroupBySortProps()
Verify XPLAIN style handling of sort properties.
|
void |
testIndexScan()
Verify XPLAIN style handling of an INDEX scan.
|
void |
testInsertResultSet()
A simple test of an INSERT result set.
|
void |
testMaxFromIndex()
A simple test of the INDEX_KEY_OPT special situation.
|
void |
testOuterJoin()
A simple test of a LEFT OUTER JOIN and EMPTY_RIGHT_ROWS values.
|
void |
testPlanExporterEncoding()
Test that queries that contain non-ASCII characters are not garbled
by the plan exporter tool.
|
void |
testPlanExporterHandlingSpecialCharacters()
Test that queries that contain characters with a special meaning in
XML are not garbled by the plan exporter tool.
|
void |
testPlanExporterIllegalFileAccess() |
void |
testPlanExporterSchemaExistence() |
void |
testPlanExporterSpecialCharactersInSchema()
Verify that the plan exporter doesn't choke on special characters in
the name of the XPLAIN schema.
|
void |
testScanDeletedRows()
A simple test of a non-zero value for numDeletedRowsVisited.
|
void |
testScanPositions()
A simple test to verify that startPosition and stopPosition work.
|
void |
testSimpleQuery()
Verify that XPLAIN style captures basic statistics and timings.
|
void |
testSimpleQueryMultiWithInvalidation()
Tests that invalidation of a statement after compile-time doesn't result
in duplicate entries in the XPLAIN-table(s).
|
void |
testSimpleXplainOnly() |
void |
testSortResultSet()
A simple test of a SORT result set.
|
void |
testTableNotValid()
A simple test of table with the wrong 'shape'.
|
void |
testUnionQuery()
A simple test of a UNION query.
|
void |
testUpdateResultSet()
A simple test of an UPDATE result set.
|
void |
testXplainOnlyExecutePrepared() |
void |
testXplainOnlyPrepared() |
private void |
verifyNonNullDRDA_ID(java.sql.Statement s) |
private void |
verifySensibleResultSetTimings(java.sql.Statement s)
Make some basic first-order checks on the RESULTSET_TIMINGS rows.
|
private void |
verifySensibleStatementTimings(java.sql.Statement s)
Make some basic first-order checks on the STATEMENT_TIMINGS rows.
|
private static void |
verifyXplainUnset(java.sql.Statement s) |
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, emptyStatementCache, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbeddedalarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isJava8, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemProperty, sleep, sleepAtLeastOneTick, traceitassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toStringprivate static long timeSuiteStarted
private static java.lang.String[] tableNames
public static junit.framework.Test suite()
protected void setUp()
throws java.sql.SQLException
setUp in class junit.framework.TestCasejava.sql.SQLExceptionprivate static void createSchemaObjects(java.sql.Statement st)
throws java.sql.SQLException
java.sql.SQLExceptionprivate static boolean hasTable(java.sql.Statement s,
java.lang.String schemaName,
java.lang.String tableName)
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void enableXplainStyle(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void enableXplainStyleWithTiming(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void enableXplainOnlyMode(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void clearXplainOnlyMode(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void disableXplainStyle(java.sql.Statement s)
throws java.lang.Exception
s - java.lang.Exceptionprivate static void verifyXplainUnset(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate void verifyNonNullDRDA_ID(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate void dumpResultSets(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate void dumpStatements(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate java.lang.String getStmtID(java.sql.Statement s)
throws java.sql.SQLException
s - Statementjava.sql.SQLExceptionprivate java.lang.String[] getStmtIDArray(java.sql.Statement s,
int length)
throws java.sql.SQLException
s - Statementjava.sql.SQLExceptionprivate java.lang.Object getADocument(java.lang.String file)
throws java.lang.Exception
file - name of the XML file - without extensionjava.lang.Exceptionprivate java.lang.String readStatement(java.lang.String file)
throws java.lang.Exception
file - XML filejava.lang.Exceptionprivate int countNode(java.lang.String file)
throws java.lang.Exception
file - XML filejava.lang.Exceptionprivate java.lang.String getNodeName(java.lang.String file)
throws java.lang.Exception
file - XML filejava.lang.Exceptionprivate java.lang.String getNodeAttribute(java.lang.String file,
java.lang.String attribute,
int node)
throws java.lang.Exception
file - XML fileattribute - name of the attributenode - node which this attribute belongs tojava.lang.Exceptionpublic void testPlanExporterSchemaExistence()
throws java.lang.Exception
java.lang.Exceptionpublic void testPlanExporterIllegalFileAccess()
throws java.lang.Exception
java.lang.Exceptionpublic void testPlanExporterSpecialCharactersInSchema()
throws java.lang.Exception
java.lang.Exceptionpublic void testSimpleQueryMultiWithInvalidation()
throws java.lang.Exception
This test is timing-dependent, and may not trigger the bug under all circumstances.
See DERBY-4849.
java.lang.Exception - if something goes wrongpublic void testSimpleQuery()
throws java.lang.Exception
java.io.IOExceptionjava.security.PrivilegedActionExceptionjava.net.MalformedURLExceptionjava.lang.Exceptionprivate java.lang.String getStmtIDByName(java.sql.Statement s,
java.lang.String sName)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testSimpleXplainOnly()
throws java.lang.Exception
java.lang.Exceptionpublic void testXplainOnlyExecutePrepared()
throws java.lang.Exception
java.lang.Exceptionpublic void testXplainOnlyPrepared()
throws java.lang.Exception
java.lang.Exceptionprivate void verifySensibleStatementTimings(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate void verifySensibleResultSetTimings(java.sql.Statement s)
throws java.sql.SQLException
java.sql.SQLExceptionprivate long getNonNegativeLong(java.sql.ResultSet rs,
java.lang.String cName)
throws java.sql.SQLException
java.sql.SQLExceptionprivate java.sql.Timestamp getNonNullTimestamp(java.sql.ResultSet rs,
java.lang.String cName)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIndexScan()
throws java.lang.Exception
java.lang.Exceptionpublic void testConstraintScan()
throws java.lang.Exception
java.lang.Exceptionpublic void testGroupBySortProps()
throws java.lang.Exception
java.lang.Exceptionpublic void testDistinctAggregateSortProps()
throws java.lang.Exception
java.lang.Exceptionpublic void testAggregationResultSet()
throws java.lang.Exception
java.lang.Exceptionpublic void testInsertResultSet()
throws java.lang.Exception
java.lang.Exceptionpublic void testUpdateResultSet()
throws java.lang.Exception
java.lang.Exceptionpublic void testDeleteResultSet()
throws java.lang.Exception
java.lang.Exceptionpublic void testSortResultSet()
throws java.lang.Exception
java.lang.Exceptionpublic void testUnionQuery()
throws java.lang.Exception
java.lang.Exceptionpublic void testDDLCreateTable()
throws java.lang.Exception
java.lang.Exceptionpublic void testMaxFromIndex()
throws java.lang.Exception
java.lang.Exceptionpublic void testOuterJoin()
throws java.lang.Exception
java.lang.Exceptionpublic void testScanPositions()
throws java.lang.Exception
java.lang.Exceptionpublic void testScanDeletedRows()
throws java.lang.Exception
java.lang.Exceptionpublic void testAlwaysEmptyResultSet()
throws java.lang.Exception
java.lang.Exceptionpublic void testTableNotValid()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testPlanExporterEncoding()
throws java.lang.Exception
java.lang.Exceptionpublic void testPlanExporterHandlingSpecialCharacters()
throws java.lang.Exception
java.lang.ExceptionApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.