Issue Details (XML | Word | Printable)

Key: DERBY-1716
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Yip Ng
Reporter: Yip Ng
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Revoking select privilege from a user times out when that user still have a cursor open.

Created: 17/Aug/06 08:26 PM   Updated: 13/Dec/07 09:05 AM
Return to search
Component/s: SQL
Affects Version/s: 10.2.1.6, 10.2.2.0, 10.3.1.4
Fix Version/s: 10.2.2.0, 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works derby1716-trunk-diff01a.txt 2006-09-23 02:15 AM Yip Ng 11 kB
Text File Licensed for inclusion in ASF works derby1716-trunk-diff02.txt 2006-09-26 08:44 PM Yip Ng 8 kB
Text File Licensed for inclusion in ASF works derby1716-trunk-diff03.txt 2006-10-06 05:45 PM Yip Ng 8 kB
Text File Licensed for inclusion in ASF works derby1716-trunk-stat01a.txt 2006-09-23 02:15 AM Yip Ng 0.5 kB
Text File Licensed for inclusion in ASF works derby1716-trunk-stat02.txt 2006-09-26 08:44 PM Yip Ng 0.4 kB
Text File Licensed for inclusion in ASF works derby1716-trunk-stat03.txt 2006-10-06 05:45 PM Yip Ng 0.4 kB
Environment: Sun JDK 1.4.2
Issue Links:
Reference
 

Issue & fix info: Patch Available
Resolution Date: 10/Oct/06 05:42 AM


 Description  « Hide
Revoking table select privilege from a user will time out if that user still have an open cursor on that table.
Hence, a database owner will not be able to revoke select privilege from any user(s) if they still have a cursor
open. i.e.:

ij version 10.2
ij> connect 'jdbc:derby:cs1;create=true' user 'user1' as user1;
WARNING 01J14: SQL authorization is being used without first enabling authentication.
ij> connect 'jdbc:derby:cs1' user 'user3' as user3;
WARNING 01J14: SQL authorization is being used without first enabling authentication.
ij(USER3)> set connection user1;
ij(USER1)> create table t1001 (c varchar(1));
0 rows inserted/updated/deleted
ij(USER1)> insert into t1001 values 'a', 'b', 'c';
3 rows inserted/updated/deleted
ij(USER1)> grant select on t1001 to user3;
0 rows inserted/updated/deleted
ij(USER1)> set connection user3;
ij(USER3)> autocommit off;
ij(USER3)> GET CURSOR crs1 AS 'select * from user1.t1001';
ij(USER3)> next crs1;
C
----
a
ij(USER3)> set connection user1;
ij(USER1)> -- revoke select privilege while user3 still have an open cursor
revoke select on t1001 from user3;
ERROR 40XL1: A lock could not be obtained within the time requested
ij(USER1)> select * from syscs_diag.lock_table;
XID |TYPE |MODE|TABLENAME |LOCKNAME |STATE|TABLETYPE|LOCK&|INDEXNAME
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
130 |TABLE|IS |SYSTABLEPERMS |Tablelock |GRANT|S |4 |NULL
130 |ROW |S |SYSTABLEPERMS |(1,7) |GRANT|S |2 |NULL
130 |TABLE|IS |T1001 |Tablelock |GRANT|T |1 |NULL

3 rows selected
ij(USER1)> set connection user3;
ij(USER3)> next crs1;
C
----
b
ij(USER3)> next crs1;
C
----
c
ij(USER3)> close crs1;
ij(USER3)>

Is there a reason why Derby still keep shared locks on SYS.SYSTABLEPERMS during fetch?


sysinfo:

------------------ Java Information ------------------
Java Version: 1.4.2_12
Java Vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\j2re1.4.2_12
Java classpath: derby.jar;derbytools.jar
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user name: Yip
Java user home: C:\Documents and Settings\Yip
Java user dir: C:\work3\derby\tests\derby-10.2.1.0\lib
java.specification.name: Java Platform API Specification
java.specification.version: 1.4
--------- Derby Information --------
JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
[C:\work3\derby\tests\derby-10.2.1.0\lib\derby.jar] 10.2.1.0 beta - (430903)
[C:\work3\derby\tests\derby-10.2.1.0\lib\derbytools.jar] 10.2.1.0 beta - (430903)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [de_DE]
         version: 10.2.1.0 - (430903)
Found support for locale: [es]
         version: 10.2.1.0 - (430903)
Found support for locale: [fr]
         version: 10.2.1.0 - (430903)
Found support for locale: [it]
         version: 10.2.1.0 - (430903)
Found support for locale: [ja_JP]
         version: 10.2.1.0 - (430903)
Found support for locale: [ko_KR]
         version: 10.2.1.0 - (430903)
Found support for locale: [pt_BR]
         version: 10.2.1.0 - (430903)
Found support for locale: [zh_CN]
         version: 10.2.1.0 - (430903)
Found support for locale: [zh_TW]
         version: 10.2.1.0 - (430903)
------------------------------------------------------


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Yip Ng made changes - 17/Aug/06 08:26 PM
Field Original Value New Value
Link This issue is related to DERBY-464 [ DERBY-464 ]
Yip Ng made changes - 20/Sep/06 07:49 AM
Description Revoking table select privilege from a user will time out if that user still have an open cursor on that table.
Hence, a database owner will not be able to revoke select privilege from any user(s) if they still have a cursor
open. i.e.:

ij version 10.2
ij> connect 'jdbc:derby:cs1;create=true' user 'user1' as user1;
WARNING 01J14: SQL authorization is being used without first enabling authentication.
ij> connect 'jdbc:derby:cs1' user 'user3' as user3;
WARNING 01J14: SQL authorization is being used without first enabling authentication.
ij(USER3)> set connection user1;
ij(USER1)> create table t1001 (c varchar(1));
0 rows inserted/updated/deleted
ij(USER1)> insert into t1001 values 'a', 'b', 'c';
3 rows inserted/updated/deleted
ij(USER1)> grant select on t1001 to user3;
0 rows inserted/updated/deleted
ij(USER1)> set connection user3;
ij(USER3)> GET CURSOR crs1 AS 'select * from user1.t1001';
ij(USER3)> next crs1;
C
----
a
ij(USER3)> set connection user1;
ij(USER1)> -- revoke select privilege while user3 still have an open cursor
revoke select on t1001 from user3;
ERROR 40XL1: A lock could not be obtained within the time requested
ij(USER1)> select * from syscs_diag.lock_table;
XID |TYPE |MODE|TABLENAME |LOCKNAME |STATE|TABLETYPE|LOCK&|INDEXNAME
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
130 |TABLE|IS |SYSTABLEPERMS |Tablelock |GRANT|S |4 |NULL
130 |ROW |S |SYSTABLEPERMS |(1,7) |GRANT|S |2 |NULL
130 |TABLE|IS |T1001 |Tablelock |GRANT|T |1 |NULL

3 rows selected
ij(USER1)> set connection user3;
ij(USER3)> next crs1;
C
----
b
ij(USER3)> next crs1;
C
----
c
ij(USER3)> close crs1;
ij(USER3)>

Is there a reason why Derby still keep shared locks on SYS.SYSTABLEPERMS during fetch?


sysinfo:

------------------ Java Information ------------------
Java Version: 1.4.2_12
Java Vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\j2re1.4.2_12
Java classpath: derby.jar;derbytools.jar
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user name: Yip
Java user home: C:\Documents and Settings\Yip
Java user dir: C:\work3\derby\tests\derby-10.2.1.0\lib
java.specification.name: Java Platform API Specification
java.specification.version: 1.4
--------- Derby Information --------
JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
[C:\work3\derby\tests\derby-10.2.1.0\lib\derby.jar] 10.2.1.0 beta - (430903)
[C:\work3\derby\tests\derby-10.2.1.0\lib\derbytools.jar] 10.2.1.0 beta - (430903)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [de_DE]
         version: 10.2.1.0 - (430903)
Found support for locale: [es]
         version: 10.2.1.0 - (430903)
Found support for locale: [fr]
         version: 10.2.1.0 - (430903)
Found support for locale: [it]
         version: 10.2.1.0 - (430903)
Found support for locale: [ja_JP]
         version: 10.2.1.0 - (430903)
Found support for locale: [ko_KR]
         version: 10.2.1.0 - (430903)
Found support for locale: [pt_BR]
         version: 10.2.1.0 - (430903)
Found support for locale: [zh_CN]
         version: 10.2.1.0 - (430903)
Found support for locale: [zh_TW]
         version: 10.2.1.0 - (430903)
------------------------------------------------------
Revoking table select privilege from a user will time out if that user still have an open cursor on that table.
Hence, a database owner will not be able to revoke select privilege from any user(s) if they still have a cursor
open. i.e.:

ij version 10.2
ij> connect 'jdbc:derby:cs1;create=true' user 'user1' as user1;
WARNING 01J14: SQL authorization is being used without first enabling authentication.
ij> connect 'jdbc:derby:cs1' user 'user3' as user3;
WARNING 01J14: SQL authorization is being used without first enabling authentication.
ij(USER3)> set connection user1;
ij(USER1)> create table t1001 (c varchar(1));
0 rows inserted/updated/deleted
ij(USER1)> insert into t1001 values 'a', 'b', 'c';
3 rows inserted/updated/deleted
ij(USER1)> grant select on t1001 to user3;
0 rows inserted/updated/deleted
ij(USER1)> set connection user3;
ij(USER3)> autocommit off;
ij(USER3)> GET CURSOR crs1 AS 'select * from user1.t1001';
ij(USER3)> next crs1;
C
----
a
ij(USER3)> set connection user1;
ij(USER1)> -- revoke select privilege while user3 still have an open cursor
revoke select on t1001 from user3;
ERROR 40XL1: A lock could not be obtained within the time requested
ij(USER1)> select * from syscs_diag.lock_table;
XID |TYPE |MODE|TABLENAME |LOCKNAME |STATE|TABLETYPE|LOCK&|INDEXNAME
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
130 |TABLE|IS |SYSTABLEPERMS |Tablelock |GRANT|S |4 |NULL
130 |ROW |S |SYSTABLEPERMS |(1,7) |GRANT|S |2 |NULL
130 |TABLE|IS |T1001 |Tablelock |GRANT|T |1 |NULL

3 rows selected
ij(USER1)> set connection user3;
ij(USER3)> next crs1;
C
----
b
ij(USER3)> next crs1;
C
----
c
ij(USER3)> close crs1;
ij(USER3)>

Is there a reason why Derby still keep shared locks on SYS.SYSTABLEPERMS during fetch?


sysinfo:

------------------ Java Information ------------------
Java Version: 1.4.2_12
Java Vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\j2re1.4.2_12
Java classpath: derby.jar;derbytools.jar
OS name: Windows XP
OS architecture: x86
OS version: 5.1
Java user name: Yip
Java user home: C:\Documents and Settings\Yip
Java user dir: C:\work3\derby\tests\derby-10.2.1.0\lib
java.specification.name: Java Platform API Specification
java.specification.version: 1.4
--------- Derby Information --------
JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
[C:\work3\derby\tests\derby-10.2.1.0\lib\derby.jar] 10.2.1.0 beta - (430903)
[C:\work3\derby\tests\derby-10.2.1.0\lib\derbytools.jar] 10.2.1.0 beta - (430903)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale : [English/United States [en_US]]
Found support for locale: [de_DE]
         version: 10.2.1.0 - (430903)
Found support for locale: [es]
         version: 10.2.1.0 - (430903)
Found support for locale: [fr]
         version: 10.2.1.0 - (430903)
Found support for locale: [it]
         version: 10.2.1.0 - (430903)
Found support for locale: [ja_JP]
         version: 10.2.1.0 - (430903)
Found support for locale: [ko_KR]
         version: 10.2.1.0 - (430903)
Found support for locale: [pt_BR]
         version: 10.2.1.0 - (430903)
Found support for locale: [zh_CN]
         version: 10.2.1.0 - (430903)
Found support for locale: [zh_TW]
         version: 10.2.1.0 - (430903)
------------------------------------------------------
Yip Ng made changes - 21/Sep/06 11:10 PM
Assignee Yip Ng [ yipng ]
Yip Ng made changes - 22/Sep/06 05:09 PM
Status Open [ 1 ] In Progress [ 3 ]
Yip Ng made changes - 23/Sep/06 02:15 AM
Attachment derby1716-trunk-stat01a.txt [ 12341447 ]
Attachment derby1716-trunk-diff01a.txt [ 12341448 ]
Yip Ng made changes - 23/Sep/06 02:15 AM
Derby Info [Patch Available]
Mike Matrigali made changes - 24/Sep/06 10:07 PM
Derby Info [Patch Available]
Yip Ng made changes - 26/Sep/06 08:44 PM
Attachment derby1716-trunk-diff02.txt [ 12341744 ]
Attachment derby1716-trunk-stat02.txt [ 12341743 ]
Yip Ng made changes - 26/Sep/06 08:44 PM
Derby Info [Patch Available]
Yip Ng made changes - 26/Sep/06 08:44 PM
Affects Version/s 10.3.0.0 [ 12310800 ]
Affects Version/s 10.2.2.0 [ 12312027 ]
Yip Ng made changes - 06/Oct/06 05:45 PM
Attachment derby1716-trunk-stat03.txt [ 12342466 ]
Attachment derby1716-trunk-diff03.txt [ 12342467 ]
Mike Matrigali made changes - 07/Oct/06 03:34 PM
Fix Version/s 10.3.0.0 [ 12310800 ]
Mike Matrigali made changes - 10/Oct/06 05:42 AM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Rick Hillegas made changes - 28/Nov/06 06:20 PM
Fix Version/s 10.2.2.0 [ 12312027 ]
Andrew McIntyre made changes - 13/Dec/07 09:05 AM
Status Resolved [ 5 ] Closed [ 6 ]