[ 
https://issues.apache.org/jira/browse/DERBY-5426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mamta A. Satoor updated DERBY-5426:
-----------------------------------

    Attachment: DERBY4437Sequence.java

The attached program takes two parameters. First on determines how many threads 
will be spawned. Second one determines how many insert will be performed by 
each one of those threads. The threads issue a commit after every 1000 rows. I 
could add another parameter to the program which will determine how often 
commit should be performed(rather than every 1000 rows that I hard coded in the 
program right now). I have run this program with various paramter values and 
have not run into sequence contention problem yet. The latest run which has not 
finished yet is as follows
java -Dderby.locks.waitTimeout=0 DERBY4437Sequence 10 1000000000 

Not sure if value '0' means for derby.locks.waitTimeout.But I have tried value 
1 as well with fewer insert rows as shown below and that didn't result in 
problem.
java -Dderby.locks.waitTimeout=1 DERBY4437Sequence 10 10000000

The ouptut from the program is pretty verbose so when I run it, I direct the 
output to a text file. If there was an exception thrown, the output will have 
string 'error' in it but I haven't seen that yet in my few runs of the program.
$ time java -Dderby.locks.waitTimeout=1 DERBY4437Sequence 10 10000000 > 
dellater.txt

I will appreciate any ideas on how to make this program run into sequence 
contention exception. Thanks

> Improve the error raised by too much contention on a sequence/identity.
> -----------------------------------------------------------------------
>
>                 Key: DERBY-5426
>                 URL: https://issues.apache.org/jira/browse/DERBY-5426
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.8.2.1, 10.9.0.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>             Fix For: 10.8.2.2, 10.9.0.0
>
>         Attachments: DERBY4437Sequence.java, 
> derby-5426-01-aa-improveError.diff
>
>
> Currently, when there is too much contention on a sequence/identity, Derby 
> raises an error saying so. There are two properties which the user can adjust 
> in order to reduce the risk of this error:
> derby.locks.waitTimeout
> derby.language.sequence.preallocator
> It would be good to point the user at these knobs. The following change would 
> improve this error reporting:
> 1) Raise a lock timeout SQLException
> 2) Chain a "too much contention" SQLException (X0Y84) to the lock timeout.
> 3) Make the "too much contention" exception suggest that the user adjust the 
> properties mentioned above.
> To make the code easier to understand, the exception raising could replace 
> the loop exit inside the following "if" block in 
> SequenceUpdater.getCurrentValueAndAdvance():
>             if (
>                 (_lockTimeoutInMillis >= 0L) &&
>                 ( (System.currentTimeMillis() - startTime.longValue()) > 
> _lockTimeoutInMillis )
>                 )
>             {
>                 break;
>             }
> This approach was recommended by the discussion on DERBY-5423.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to