[
https://issues.apache.org/jira/browse/DERBY-3330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mike Matrigali updated DERBY-3330:
----------------------------------
At this point you should somehow document the implementation that you are
planning to support the functional spec. That way I can comment on whether
or not I think it should work. It is hard just going from your patch with
almost no comments. I suggested the approach, and am having a hard time
remembering at this point - imagine what other reviewers are going through.
With regard to this specific question, it depends on what rows you are
going to support in the new tree. To make it easier to talk about let's
just consider the simplest case of a single key index. Then with respect
to "deleted" rows will you ever support duplicate entries in the tree,
as below:
deleted bit key rowlocation
----------- --- -----------
false null 1,7
false null 1,8
true a 1,9
false a 1,10
I think the algorithms and edge cases are probably easier if you keep the
rule that disregarding the deleted bit, there can never be a duplicate non-null
key in the tree. This makes it easier to deal with uncommitted transactions and
duplicates and deleted rows. If you pick this rule then you should read and
understand the code in BTreeController that deals with this case in the
old indexes. This code starts with the comment:
// If the row is there already, simply undelete it.
// The rationale for this is, since the index does
// not support duplicates, the only way we could ...
Remember that getting a lock on a deleted row does not mean it is a committed
deleted row, it may have been deleted by the current transaction.
Probably the most straightforward is to follow what we do currently for
unique indexes, but apply it to this new index which allows duplicate null's
but non duplicate non-null.
I don't know the exact answer on locking, it is complicated as we have never
locked
rows to the right of a row during an insert before. This can have some
negative concurrency
aspects.
> 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: 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.