public class OnlineCompressTest extends BaseTest
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
verbose |
SPACE_INFO_ESTIMSPACESAVING, SPACE_INFO_IS_INDEX, SPACE_INFO_NUM_ALLOC, SPACE_INFO_NUM_FREE, SPACE_INFO_NUM_UNFILLED, SPACE_INFO_NUMCOLS, SPACE_INFO_PAGE_SIZE
Constructor and Description |
---|
OnlineCompressTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
callCompress(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String tableName,
boolean purgeRows,
boolean defragmentRows,
boolean truncateEnd,
boolean commit_operation)
call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE() system procedure.
|
static void |
callWaitForPostCommit(java.sql.Connection conn) |
private void |
checkPurgePhase(java.sql.Connection conn,
boolean create_table,
boolean long_table,
java.lang.String schemaName,
java.lang.String table_name,
int num_rows)
Check/exercise purge pass phase.
|
protected void |
createAndLoadLargeTable(java.sql.Connection conn,
boolean create_table,
java.lang.String tblname,
int num_rows,
int start_value)
Create and load a table with large columns.
|
private void |
createAndLoadLongTable(java.sql.Connection conn,
boolean create_table,
java.lang.String tblname,
int num_rows)
Create and load a table with long columns and long rows.
|
protected void |
createAndLoadTable(java.sql.Connection conn,
boolean create_table,
java.lang.String tblname,
int num_rows,
int start_value)
Create and load a table.
|
private void |
deleteAllRows(java.sql.Connection conn,
boolean create_table,
boolean long_table,
java.lang.String schemaName,
java.lang.String table_name,
int num_rows) |
private void |
log_wrong_count(java.lang.String error_msg,
java.lang.String table_name,
int num_rows,
int expected_val,
int actual_val,
int[] before_info,
int[] after_info) |
static void |
main(java.lang.String[] argv) |
private void |
simpleDeleteAllRows(java.sql.Connection conn,
boolean create_table,
boolean long_table,
java.lang.String schemaName,
java.lang.String table_name,
int num_rows) |
private void |
test1(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 1 - various # page tests, regular row/columns
perform a number of insert/delete/compress operations on a variety
of sized tables, use space allocation information to verify that
compression is happening and use consistency checker to verify that
tables and indexes are all valid following the operations.
|
private void |
test2(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 2 - check repeated delete tests.
|
private void |
test3(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 3 - various # page tests, long row and long columns
perform a number of insert/delete/compress operations on a variety
of sized tables, use space allocation information to verify that
compression is happening and use consistency checker to verify that
tables and indexes are all valid following the operations.
|
private void |
test4(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 4 - check repeated delete tests.
|
private void |
test5_cleanup(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String table_name,
int num_rows)
Cleanup after test5_run
|
private void |
test5_load(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String table_name,
int num_rows)
Create and load table for test5.
|
private void |
test5_run(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String table_name,
int num_rows)
Execute test5, simple defragement test.
|
private void |
test5(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 5 - simple defragment test.
|
private void |
test6(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 6 - Online compress test for table that spans more than 1 AllocExtent.
|
private void |
test7(java.sql.Connection conn,
java.lang.String test_name,
java.lang.String table_name)
Test 7 - Online compress test for fetching more rows than buffer limit.
|
void |
testList(java.sql.Connection conn) |
beginTest, checkAllConsistency, checkConsistency, createDebugSystemProcedures, createTable, dump_table, endTest, executeQuery, get_lock_info, getSpaceInfo, log, logError, runTests, testProgress, total_pages
protected void callCompress(java.sql.Connection conn, java.lang.String schemaName, java.lang.String tableName, boolean purgeRows, boolean defragmentRows, boolean truncateEnd, boolean commit_operation) throws java.sql.SQLException
Utility test function to call the system procedure.
java.sql.SQLException
protected void createAndLoadTable(java.sql.Connection conn, boolean create_table, java.lang.String tblname, int num_rows, int start_value) throws java.sql.SQLException
If create_table is set creates a test data table with indexes. Loads num_rows into the table. This table defaults to 32k page size. This schema fits 25 rows per page
conn
- Connection to use for sql execution.create_table
- If true, create new table - otherwise load into
existing table.tblname
- table to use.num_rows
- number of rows to add to the table.StandardException
- Standard exception policy.java.sql.SQLException
protected void createAndLoadLargeTable(java.sql.Connection conn, boolean create_table, java.lang.String tblname, int num_rows, int start_value) throws java.sql.SQLException
If create_table is set creates a test data table with indexes. Loads num_rows into the table. This table defaults to 32k page size.
conn
- Connection to use for sql execution.create_table
- If true, create new table - otherwise load into
existing table.tblname
- table to use.num_rows
- number of rows to add to the table.start_value
- Starting number from which num_rows are insertedStandardException
- Standard exception policy.java.sql.SQLException
private void createAndLoadLongTable(java.sql.Connection conn, boolean create_table, java.lang.String tblname, int num_rows) throws java.sql.SQLException
If create_table is set creates a test data table with indexes. Loads num_rows into the table. This table defaults to 32k page size.
schema of table: keycol int, longcol1 clob(200k), longrow1 varchar(10000), longrow2 varchar(10000), longrow3 varchar(10000), longrow4 varchar(10000), indcol1 int, indcol2 int, indcol3 int, data1 varchar(2000), data2 varchar(2000) longrow5 varchar(10000), longrow6 varchar(10000), longrow7 varchar(10000), longrow8 varchar(10000), longcol2 clob(200k),
conn
- Connection to use for sql execution.create_table
- If true, create new table - otherwise load into
existing table.tblname
- table to use.num_rows
- number of rows to add to the table.StandardException
- Standard exception policy.java.sql.SQLException
private void log_wrong_count(java.lang.String error_msg, java.lang.String table_name, int num_rows, int expected_val, int actual_val, int[] before_info, int[] after_info)
private void deleteAllRows(java.sql.Connection conn, boolean create_table, boolean long_table, java.lang.String schemaName, java.lang.String table_name, int num_rows) throws java.sql.SQLException
java.sql.SQLException
private void simpleDeleteAllRows(java.sql.Connection conn, boolean create_table, boolean long_table, java.lang.String schemaName, java.lang.String table_name, int num_rows) throws java.sql.SQLException
java.sql.SQLException
private void checkPurgePhase(java.sql.Connection conn, boolean create_table, boolean long_table, java.lang.String schemaName, java.lang.String table_name, int num_rows) throws java.sql.SQLException
Assumes that either test creates the table, or called on an empty table with no committed deleted rows or free pages in the middle of the table in it.
StandardException
- Standard exception policy.java.sql.SQLException
private void test1(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
perform a number of insert/delete/compress operations on a variety of sized tables, use space allocation information to verify that compression is happening and use consistency checker to verify that tables and indexes are all valid following the operations.
loop through testing interesting row count cases. The cases are 0 rows - basic edge case, 2 page table: 1 alloc, 1 user page 1 row - another edge case, 2 page table: 1 alloc, 1 user page 50 rows - 3 page table case: 1 alloc, 1 user page, 1 user page freed 4000 rows - reasonable number of pages to test out, still 1 alloc page note that row numbers greater than 4000 may lead to lock escalation issues, if queries like "delete from x" are used to delete all the rows.
java.sql.SQLException
private void test2(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
There was a timing error where test1 would usually pass, but repeated execution of this test found a timing problem with allocation using an "unallocated" page and getting an I/O error.
java.sql.SQLException
private void test3(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
perform a number of insert/delete/compress operations on a variety of sized tables, use space allocation information to verify that compression is happening and use consistency checker to verify that tables and indexes are all valid following the operations.
loop through testing interesting row count cases. The cases are 0 rows - basic edge case 1 row - another edge case 100 rows - ~50 meg table 4000 rows - ~2 gig table note that row numbers greater than 4000 may lead to lock escalation issues, if queries like "delete from x" are used to delete all the rows.
java.sql.SQLException
private void test4(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
There was a timing error where test1 would usually pass, but repeated execution of this test found a timing problem with allocation using an "unallocated" page and getting an I/O error.
java.sql.SQLException
private void test5_load(java.sql.Connection conn, java.lang.String schemaName, java.lang.String table_name, int num_rows) throws java.sql.SQLException
schema of table: keycol int, onehalf int, onethird int, c varchar(300)
conn
- Connection to use for sql execution.schemaName
- the schema to use.table_name
- the table to use.num_rows
- number of rows to add to the table.StandardException
- Standard exception policy.java.sql.SQLException
private void test5_run(java.sql.Connection conn, java.lang.String schemaName, java.lang.String table_name, int num_rows) throws java.sql.SQLException
o delete every other row, defragment o delete every third row, defragment o delete last 1000 rows, defragment o delete first 512 rows, defragment.
run test with at least 2000 rows.
java.sql.SQLException
private void test5_cleanup(java.sql.Connection conn, java.lang.String schemaName, java.lang.String table_name, int num_rows) throws java.sql.SQLException
java.sql.SQLException
private void test5(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
Create dataset and then: o delete every other row, defragment o delete every third row, defragment o delete last 1000 rows, defragment o delete first 512 rows, defragment.
run test with at least 2000 rows.
java.sql.SQLException
private void test6(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
Create dataset with Data spread over more than 1 AllcExtent and then: delete enough rows so that the last AllocExtent is empty. Try OnlineCompress with Purge, Defragment and Truncate
run test with at least 103000 rows.
java.sql.SQLException
private void test7(java.sql.Connection conn, java.lang.String test_name, java.lang.String table_name) throws java.sql.SQLException
For smaller row size, if number of rows per page is more than max buffer size, then check if the remaining rows are also fetched for Compress Operation
java.sql.SQLException
public void testList(java.sql.Connection conn) throws java.sql.SQLException
public static void callWaitForPostCommit(java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
public static void main(java.lang.String[] argv) throws java.lang.Throwable
java.lang.Throwable
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.