1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857
|
/*
Derby - Class org.apache.derbyTesting.functionTests.tests.store.TableLockBasicTest
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.derbyTesting.functionTests.tests.store;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Locale;
import junit.framework.Test;
import org.apache.derbyTesting.junit.BaseJDBCTestCase;
import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
import org.apache.derbyTesting.junit.JDBC;
import org.apache.derbyTesting.junit.LocaleTestSetup;
import org.apache.derbyTesting.junit.TestConfiguration;
/**
* Very basic single user testing of table locking, verify that the right locks
* are obtained for simple operations. This test only looks at table and
* row logical locks, it does not verify physical latches or lock ordering.
--
* The basic methodology is:
* start transaction
* simple operation
* print lock table which should match the master
* end transation
*
*/
public class TableLockBasicTest extends BaseJDBCTestCase {
public TableLockBasicTest(String name) {
super(name);
}
public static Test suite() {
Test test = TestConfiguration.defaultSuite(TableLockBasicTest.class);
test = DatabasePropertyTestSetup.singleProperty(test,
"derby.storage.rowLocking", "false", true);
test = new LocaleTestSetup(test, Locale.ENGLISH);
return TestConfiguration.singleUseDatabaseDecorator(test);
}
protected void setUp() throws SQLException {
Statement s = createStatement();
s.execute("CREATE FUNCTION PADSTRING (DATA VARCHAR(32000), "
+ "LENGTH INTEGER) RETURNS VARCHAR(32000) EXTERNAL NAME "
+ "'org.apache.derbyTesting.functionTests.util.Formatters"
+ ".padString' LANGUAGE JAVA PARAMETER STYLE JAVA");
createLockTableQueryEntries(s);
s.close();
getConnection().setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
getConnection().setAutoCommit(false);
}
private void createLockTableQueryEntries(Statement s) throws SQLException {
s.execute("create view lock_table as "
+ "select "
+ "cast(username as char(8)) as username,"
+ "cast(t.type as char(8)) as trantype,"
+ "cast(l.type as char(8)) as type,"
+ "cast(lockcount as char(3)) as cnt,"
+ "mode,"
+ "cast(tablename as char(12)) as tabname,"
+ "cast(lockname as char(10)) as lockname,"
+ "state,"
+ "status "
+ "from "
+ "syscs_diag.lock_table l right outer join syscs_diag.transaction_table t "
+ "on l.xid = t.xid where l.tableType <> 'S' and t.type='UserTransaction'");
//lock table with system catalog locks included.
s.execute("create view full_lock_table as "
+ "select "
+ "cast(username as char(8)) as username, "
+ "cast(t.type as char(8)) as trantype,"
+ "cast(l.type as char(8)) as type,"
+ "cast(lockcount as char(3)) as cnt,"
+ "mode, "
+ "cast(tablename as char(12)) as tabname,"
+ "cast(lockname as char(10)) as lockname,"
+ "state,"
+ "status "
+ "from "
+ "syscs_diag.lock_table l right outer join syscs_diag.transaction_table t "
+ "on l.xid = t.xid where l.tableType <> 'S' ");
//lock table with no join.
s.execute("create view lock_table2 as "
+ "select "
+ "cast(l.xid as char(8)) as xid,"
+ "cast(l.type as char(8)) as type,"
+ "cast(lockcount as char(3)) as cnt,"
+ "mode,"
+ "cast(tablename as char(12)) as tabname,"
+ "cast(lockname as char(10)) as lockname,"
+ "state "
+ "from "
+ "syscs_diag.lock_table l "
+ "where l.tableType <> 'S' ");
//-- transaction table with no join.
s.execute("create view tran_table as "
+ "select "
+ "* "
+ "from "
+ "syscs_diag.transaction_table");
}
public void tearDown() throws Exception {
Statement st = createStatement();
st.executeUpdate("DROP FUNCTION PADSTRING");
st.execute("drop view lock_table");
st.execute("drop view full_lock_table");
st.execute("drop view lock_table2");
st.execute("drop view tran_table");
st.close();
commit();
super.tearDown();
}
public void testInsertIntoHeap() throws SQLException {
Statement st = createStatement();
st.execute("create table heap_only (a int)");
commit();
//Test insert into empty heap, should just get table lock
st.execute("insert into heap_only values (1)");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "X", "HEAP_ONLY", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
//Test insert into heap with one row, just get table lock
st.execute("insert into heap_only values (2)");
rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "X", "HEAP_ONLY", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("heap_only");
}
/**
* Test select from a heap, should get shared table lock.
*/
public void testSelectFromHeap () throws SQLException {
Statement st = createStatement();
constructHeap(st);
ResultSet rs = st.executeQuery("select a from heap_only where a = 1");
JDBC.assertFullResultSet(rs, new String[][]{
{"1"},
});
rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "S", "HEAP_ONLY", "Tablelock", "GRANT", "ACTIVE"}
});
commit();
st.close();
dropTable("heap_only");
}
private void constructHeap(Statement st) throws SQLException {
st.execute("create table heap_only (a int)");
commit();
st.execute("insert into heap_only values (1)");
commit();
st.execute("insert into heap_only values (2)");
commit();
}
/**
* Test delete from a heap, should get exclusive table lock.
*/
public void testDelectFromHeap () throws SQLException {
Statement st = createStatement();
constructHeap(st);
st.execute("delete from heap_only where a = 1");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "2", "X", "HEAP_ONLY", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("heap_only");
}
/**
* Test update to heap, should get exclusive table lock.
*/
public void testUpdateToHeap () throws SQLException {
Statement st = createStatement();
constructHeap(st);
st.execute("update heap_only set a = 1000 where a = 2");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "2", "X", "HEAP_ONLY", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("heap_only");
}
/**
* Test drop of heap, should get exclusive table lock.
*/
public void testDropHeap () throws SQLException {
Statement st = createStatement();
constructHeap(st);
st.execute("drop table heap_only");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "3", "X", "*** TRANSIEN", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("heap_only");
}
public void testCreateIndex() throws SQLException {
Statement st = createStatement();
st.execute("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096')");
st.execute("create table indexed_heap (a int, b varchar(1000))");
st.execute("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.execute("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', '4096')");
st.execute("create index a_idx on indexed_heap (a, b)");
st.execute("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize', NULL)");
rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "4", "S", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
{"APP", "UserTran", "TABLE", "1", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
{"APP", "UserTran", "TABLE", "1", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"}, });
commit();
st.close();
dropTable("indexed_heap");
}
public void testInsertIntoEmtpyIndexedHeaP() throws SQLException {
Statement st = createStatement();
st.execute("create table indexed_heap (a int, b varchar(1000))");
commit();
st.execute("create index a_idx on indexed_heap (a, b)");
commit();
// Test insert into indexed heap, should just get table lock
st.execute("insert into indexed_heap (a) values (1)");
ResultSet rs = st.executeQuery(" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][] {
{"APP", "UserTran", "TABLE", "2", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
// Test insert into indexed heap with one row, just get table lock
st.execute("insert into indexed_heap (a) values (2)");
rs = st.executeQuery(" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][] {
{"APP", "UserTran", "TABLE", "2", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"}
});
commit();
st.close();
dropTable("indexed_heap");
}
/**
* Test select from a indexed heap, should get shared table lock.
*/
public void testSelectFromIndexedHeap () throws SQLException {
Statement st = createStatement();
constructIndexedHeap(st);
ResultSet rs = st.executeQuery("select a from indexed_heap where a = 1");
JDBC.assertFullResultSet(rs, new String[][]{
{"1"},
});
rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "S", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("indexed_heap");
}
private void constructIndexedHeap(Statement st) throws SQLException {
st.execute("create table indexed_heap (a int, b varchar(1000))");
st.execute("create index a_idx on indexed_heap (a, b)");
st.execute("insert into indexed_heap (a) values (1)");
st.execute("insert into indexed_heap (a) values (2)");
commit();
}
/**
* Test delete from a indexed heap, should get exclusive table lock.
*/
public void testDeleteFromIndexedHeap () throws SQLException {
Statement st = createStatement();
constructIndexedHeap(st);
st.execute("delete from indexed_heap where a = 1");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "3", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("indexed_heap");
}
/**
* Test update to indexed heap, should get exclusive table lock.
*/
public void testUpdateToIndexedHeap () throws SQLException {
Statement st = createStatement();
constructIndexedHeap(st);
st.execute("update indexed_heap set a = 1000 where a = 2");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "4", "X", "INDEXED_HEAP", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
dropTable("indexed_heap");
}
/**
* Test drop of indexed heap, should get exclusive table lock.
*/
public void testDropIndexedHeap () throws SQLException {
Statement st = createStatement();
constructIndexedHeap(st);
st.execute("drop table indexed_heap");
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "X", "*** TRANSIEN", "Tablelock", "GRANT", "ACTIVE"},
{"APP", "UserTran", "TABLE", "4", "X", "*** TRANSIEN", "Tablelock", "GRANT", "ACTIVE"},
});
commit();
st.close();
}
/**
* Test LOCK TABLE statement
*/
public void testLockTableStatement() throws SQLException {
Statement st = createStatement();
st.execute("create table t1(c1 int)");
commit();
PreparedStatement pst = prepareStatement("lock table t1 in exclusive mode");
pst.execute();
ResultSet rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "X", "T1", "Tablelock", "GRANT", "ACTIVE"},
});
//verify that statement gets recompiled correctly
st.execute("drop table t1");
st.execute("create table t1(c1 int)");
pst.execute();
commit();
st.execute("lock table t1 in share mode");
rs = st.executeQuery(
" select * from lock_table order by tabname, type "
+ "desc, mode, cnt, lockname");
JDBC.assertFullResultSet(rs, new String[][]{
{"APP", "UserTran", "TABLE", "1", "S", "T1", "Tablelock", "GRANT", "ACTIVE"},
});
st.execute("drop table t1");
commit();
st.close();
}
/**
* verify that lock table not allowed in sys schema
*/
public void testLockTableInSysSchema() throws SQLException {
Statement st = createStatement();
assertStatementError("42X62", st,
"lock table sys.systables in exclusive mode");
st.close();
}
/**
* Test RTS output when table locking configured
*/
public void testRTSOutput() throws SQLException {
Statement st = createStatement();
st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
st.execute("create table rts(c1 int)");
st.execute("insert into rts values 1");
commit();
ResultSet rs = st.executeQuery("select * from rts with cs");
JDBC.assertFullResultSet(rs, new String[][]{
{"1"}
});
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C3\n")
+ "Statement Text: \n"
+ " select * from rts with cs\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for RTS at read committed isolation level using instantaneous share row locking chosen by the optimizer (Actual locking used: table level locking.)\n"
+ "Number of opens = 1\n"
+ "Rows seen = 1\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n"
+ " next time in milliseconds/row = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=1\n"
+ " Number of rows visited=1\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
},
});
st.execute("drop table rts");
commit();
st.close();
}
public void testDDLTableLockMode() throws SQLException {
Statement st = createStatement();
st.execute("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
st.execute("create table default_granularity(c1 int)");
st.execute("create table row_granularity(c1 int)");
st.execute("alter table row_granularity locksize row");
st.execute("create table table_granularity(c1 int)");
st.execute("alter table table_granularity locksize table");
ResultSet rs = st.executeQuery("select * from default_granularity with cs");
JDBC.assertEmpty(rs);
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C2\n")
+ "Statement Text: \n"
+ " select * from default_granularity with cs\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for DEFAULT_GRANULARITY at read committed isolation level using instantaneous share row locking chosen by the optimizer (Actual locking used: table level locking.)\n"
+ "Number of opens = 1\n"
+ "Rows seen = 0\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=0\n"
+ " Number of rows visited=0\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
}
}
);
rs = st.executeQuery("select * from default_granularity with rr");
JDBC.assertEmpty(rs);
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C2\n")
+ "Statement Text: \n"
+ " select * from default_granularity with rr\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for DEFAULT_GRANULARITY at serializable isolation level using share table locking chosen by the optimizer\n"
+ "Number of opens = 1\n"
+ "Rows seen = 0\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=0\n"
+ " Number of rows visited=0\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
}
}
);
rs = st.executeQuery("select * from default_granularity with cs");
JDBC.assertEmpty(rs);
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C2\n")
+ "Statement Text: \n"
+ " select * from default_granularity with cs\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for DEFAULT_GRANULARITY at read committed isolation level using instantaneous share row locking chosen by the optimizer (Actual locking used: table level locking.)\n"
+ "Number of opens = 1\n"
+ "Rows seen = 0\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=0\n"
+ " Number of rows visited=0\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
}
}
);
rs = st.executeQuery("select * from row_granularity with rr");
JDBC.assertEmpty(rs);
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C2\n")
+ "Statement Text: \n"
+ " select * from row_granularity with rr\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for ROW_GRANULARITY at serializable isolation level using share table locking chosen by the optimizer\n"
+ "Number of opens = 1\n"
+ "Rows seen = 0\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=0\n"
+ " Number of rows visited=0\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
}
}
);
rs = st.executeQuery("select * from table_granularity with cs");
JDBC.assertEmpty(rs);
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C2\n")
+ "Statement Text: \n"
+ " select * from table_granularity with cs\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for TABLE_GRANULARITY at read committed isolation level using instantaneous share table locking chosen by the optimizer\n"
+ "Number of opens = 1\n"
+ "Rows seen = 0\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=0\n"
+ " Number of rows visited=0\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
}
}
);
rs = st.executeQuery("select * from table_granularity with rr");
JDBC.assertEmpty(rs);
rs = st.executeQuery("values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
JDBC.assertFullResultSet(rs, new String[][]{
{"Statement Name: \n"
+ " " + (getTestConfiguration().getJDBCClient().isEmbedded() ? "null\n" : "SQL_CURLH000C2\n")
+ "Statement Text: \n"
+ " select * from table_granularity with rr\n"
+ "Parse Time: 0\n"
+ "Bind Time: 0\n"
+ "Optimize Time: 0\n"
+ "Generate Time: 0\n"
+ "Compile Time: 0\n"
+ "Execute Time: 0\n"
+ "Begin Compilation Timestamp : null\n"
+ "End Compilation Timestamp : null\n"
+ "Begin Execution Timestamp : null\n"
+ "End Execution Timestamp : null\n"
+ "Statement Execution Plan Text: \n"
+ "Table Scan ResultSet for TABLE_GRANULARITY at serializable isolation level using share table locking chosen by the optimizer\n"
+ "Number of opens = 1\n"
+ "Rows seen = 0\n"
+ "Rows filtered = 0\n"
+ "Fetch Size = 16\n"
+ " constructor time (milliseconds) = 0\n"
+ " open time (milliseconds) = 0\n"
+ " next time (milliseconds) = 0\n"
+ " close time (milliseconds) = 0\n\n"
+ "scan information:\n"
+ " Bit set of columns fetched=All\n"
+ " Number of columns fetched=1\n"
+ " Number of pages visited=1\n"
+ " Number of rows qualified=0\n"
+ " Number of rows visited=0\n"
+ " Scan type=heap\n"
+ " start position:\n"
+ " null\n"
+ " stop position:\n"
+ " null\n"
+ " qualifiers:\n"
+ " None\n"
+ " optimizer estimated row count: 6.00\n"
+ " optimizer estimated cost: 100.40"
}
}
);
st.close();
rollback();
}
}
|