⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rlliso3multi.out

📁 derby database source code.good for you.
💻 OUT
📖 第 1 页 / 共 3 页
字号:
-- the following should cause a time out, as the previous-- key lock will conflict with client_1's lock on 'b'--------------------------------------------------------------------------------insert into a values (PADSTRING('b',1000), PADSTRING('b',1000));ERROR 40XL1: A lock could not be obtained within the time requestedij(CLIENT_2)> ---------------------------------------------------------------------------------- Test 4: make sure that row lock wait in a heap scan works--------------------------------------------------------------------------------set connection client_1;ij(CLIENT_1)> autocommit off;ij(CLIENT_1)> create table test_4 (a int, b varchar(1000), c varchar(1000)) ;0 rows inserted/updated/deletedij(CLIENT_1)> commit;ij(CLIENT_1)> set connection client_2;ij(CLIENT_2)> autocommit off;ij(CLIENT_2)> commit;ij(CLIENT_2)> -- client_1 will get a single row lock in the heap.set connection client_1;ij(CLIENT_1)> insert into test_4 values (1, PADSTRING('a',1000), PADSTRING('b',1000));1 row inserted/updated/deletedij(CLIENT_1)> -- client_2 scans table, blocking on a row lock on the client_1 insert row, -- will get timout message.set connection client_2;ij(CLIENT_2)> select * from test_4;ERROR 40XL1: A lock could not be obtained within the time requestedij(CLIENT_2)> -- release the insert lock.set connection client_1;ij(CLIENT_1)> commit;ij(CLIENT_1)> -- reader should be able to see row now.set connection client_2;ij(CLIENT_2)> select * from test_4;A          |B                                                                                                                               |C                                                                                                                               -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------1          |a                                                                                                                              &|b                                                                                                                              &ij(CLIENT_2)> commit;ij(CLIENT_2)> -- cleanupset connection client_1;ij(CLIENT_1)> drop table test_4;0 rows inserted/updated/deletedij(CLIENT_1)> commit;ij(CLIENT_1)> ---------------------------------------------------------------------------------- Test 5: make sure a that a group fetch through a secondary index correctly--         handles the previous to first key locking.  In serializable the--         scanner should hold the previous to first key lock until end of --         transaction, thus blocking the attempted insert to the range.--------------------------------------------------------------------------------connect 'wombat' as scanner;ij(SCANNER)> set isolation to rr;0 rows inserted/updated/deletedij(SCANNER)> -- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.NoHoldForConnection;ij(SCANNER)> connect 'wombat' as inserter;ij(INSERTER)> set isolation to rr;0 rows inserted/updated/deletedij(INSERTER)> -- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.NoHoldForConnection;ij(INSERTER)> set connection scanner;ij(SCANNER)> autocommit off;ij(SCANNER)> create table test_5 (a int, b varchar(1000), c varchar(1000));0 rows inserted/updated/deletedij(SCANNER)> insert into test_5 values (1, PADSTRING('a',1000), PADSTRING('a',1000));1 row inserted/updated/deletedij(SCANNER)> insert into test_5 values (2, PADSTRING('b',1000), PADSTRING('b',1000));1 row inserted/updated/deletedij(SCANNER)> create index test_5_idx on test_5 (a);0 rows inserted/updated/deletedij(SCANNER)> commit;ij(SCANNER)> set connection inserter;ij(INSERTER)> autocommit off;ij(INSERTER)> commit;ij(INSERTER)> ---------------------------------------------------------------------------------- Set up scanner to be doing a row locked index to base row scan on the index.-- By using group fetch it will read and release locks on multiple rows from-- the index and save away row pointers from the index.--------------------------------------------------------------------------------set connection scanner;ij(SCANNER)> CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault','10');0 rows inserted/updated/deletedij(SCANNER)> get cursor scan_cursor as     'select a, b from test_5 where a <= 2 ';ij(SCANNER)> call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.language.bulkFetchDefault', '16');0 rows inserted/updated/deletedij(SCANNER)> -- because of group locking will get locks on 1, 2, 3, 4, and 5 and then will-- release the locks on 1, 2, 3, and 4.  The last one is released on close or-- on next call emptying the cursor.next scan_cursor;A          |B                                                                                                                               --------------------------------------------------------------------------------------------------------------------------------------------1          |a                                                                                                                              &ij(SCANNER)> ---------------------------------------------------------------------------------- Insert a row previous to all other rows, this should block and back out.--------------------------------------------------------------------------------set connection inserter;ij(INSERTER)> insert into test_5 values (0, PADSTRING('b',1000), PADSTRING('b',1000));ERROR 40XL1: A lock could not be obtained within the time requestedij(INSERTER)> ---------------------------------------------------------------------------------- The scan should finish fine without blocking.--------------------------------------------------------------------------------set connection scanner;ij(SCANNER)> next scan_cursor;A          |B                                                                                                                               --------------------------------------------------------------------------------------------------------------------------------------------2          |b                                                                                                                              &ij(SCANNER)> next scan_cursor;No current rowij(SCANNER)> -- commit the insertset connection inserter;ij(INSERTER)> commit;ij(INSERTER)> -- scanner should now see 1 and 2set connection scanner;ij(SCANNER)> close scan_cursor;ij(SCANNER)> select a from test_5;A          -----------1          2          ij(SCANNER)> ---------------------------------------------------------------------------------- cleanup.--------------------------------------------------------------------------------set connection inserter;ij(INSERTER)> commit;ij(INSERTER)> disconnect;ij> set connection scanner;ij(SCANNER)> commit;ij(SCANNER)> drop table test_5;0 rows inserted/updated/deletedij(SCANNER)> commit;ij(SCANNER)> disconnect;ij> ---------------------------------------------------------------------------------- Test 6: test update locks--------------------------------------------------------------------------------connect 'wombat' as t6scanner;ij(T6SCANNER)> set isolation to rr;0 rows inserted/updated/deletedij(T6SCANNER)> -- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.NoHoldForConnection;ij(T6SCANNER)> connect 'wombat' as t6updater;ij(T6UPDATER)> set isolation to rr;0 rows inserted/updated/deletedij(T6UPDATER)> -- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.NoHoldForConnection;ij(T6UPDATER)> connect 'wombat' as t6writer;ij(T6WRITER)> set isolation to rr;0 rows inserted/updated/deletedij(T6WRITER)> -- by default, holdability of ResultSet objects created using this Connection object is true. Following will set it to false for this connection.NoHoldForConnection;ij(T6WRITER)> run resource 'LockTableQuery.subsql';ij(T6WRITER)> create view lock_table asselect     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,    statusfrom     new org.apache.derby.diag.LockTable() l  right outer join new org.apache.derby.diag.TransactionTable() ton l.xid = t.xid where l.tableType <> 'S' and t.type='UserTransaction';0 rows inserted/updated/deletedij(T6WRITER)> --on l.xid = t.xid where l.tableType <> 'S' or l.tableType is null-- order by--     tabname, type desc, mode, cnt, lockname-- lock table with system catalog locks included.create view full_lock_table asselect     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,    statusfrom     new org.apache.derby.diag.LockTable() l right outer join new org.apache.derby.diag.TransactionTable() ton l.xid = t.xid where l.tableType <> 'S' ;0 rows inserted/updated/deletedij(T6WRITER)> -- lock table with no join.create view lock_table2 asselect     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,    statefrom     new org.apache.derby.diag.LockTable() l  where l.tableType <> 'S' ;0 rows inserted/updated/deletedij(T6WRITER)> -- transaction table with no join.create view tran_table asselect     *from     new org.apache.derby.diag.TransactionTable() t ;0 rows inserted/updated/deletedij(T6WRITER)> -- set upset connection t6updater;ij(T6UPDATER)> autocommit off;ij(T6UPDATER)> create table test_6 (a int, b int);0 rows inserted/updated/deletedij(T6UPDATER)> insert into test_6 values (1,1);1 row inserted/updated/deletedij(T6UPDATER)> insert into test_6 values (2,2);1 row inserted/updated/deletedij(T6UPDATER)> insert into test_6 values (8,8);1 row inserted/updated/deletedij(T6UPDATER)> create index test6_idx on test_6 (a);0 rows inserted/updated/deletedij(T6UPDATER)> commit;ij(T6UPDATER)> select * from lock_table order by tabname, type desc, mode, cnt, lockname;USERNAME|TRANTYPE|TYPE    |CNT |MODE|TABNAME     |LOCKNAME  |STATE|STATUS  ---------------------------------------------------------------------------ij(T6UPDATER)> ----==================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -