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

Anurag Shekhar updated DERBY-3330:
----------------------------------

    Attachment: BTreeController.diff

Thanks Mike in taking time to explain the nuances of locking in such a clear 
and detailed manner. I will shortly post a document explaining the following 
issues related to my patch
1.How insert is handled.
2.How sorting is performed (while creating the unique constraint).
3.How soft upgrade will work.

I have written the routine to perform comparison while inserting.  this routine 
is called only if all the parts of the new key are non null. This routine is 
called for both keys (left and right of the position identified to insert)

1.If no match return
2.if there is match check if its already deleted 
3.if not deleted there return a match (will result in exception)
4.if deleted try getting a lock on it
5.if lock is obtained without releasing the latch (means without waiting) the 
key was deleted withing current transaction.
6.if lock is obtained and latch is released the lock was held by some other 
transaction and might have caused change in tree. Insert process will be 
restarted again to locate the position for new key.

While fetching the left and right records I am not checking for deleted bit any 
more but checking for it only after finding a match. The fetched record is 
locked only if a match is found and its a deleted record and in that case also 
the lock will be held only if the key was deleted within same transaction. In 
case its deleted from another transaction page latch will be released and it 
will ultimately result in rescanning the tree for insert position.

I am attaching a diff for BtreeController.java (I haven't yet implemented the 
left locking protocol) Please let me know If I am doing it right.



> provide support for unique constraint over nullable columns
> -----------------------------------------------------------
>
>                 Key: DERBY-3330
>                 URL: https://issues.apache.org/jira/browse/DERBY-3330
>             Project: Derby
>          Issue Type: New Feature
>          Components: Store
>    Affects Versions: 10.4.0.0
>         Environment: all
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>         Attachments: BTreeController.diff, derby-3330-testcase.diff, 
> derby-3330.diff, derby-3330v2.diff, derby-3330v3.diff, derby-3330v4.diff, 
> FunctionalSpec_DERBY-3330-V2.html, FunctionalSpec_DERBY-3330.html
>
>
> Allow unique constraint over nullable field. Right now derby support unique 
> constraint only over not null columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to