Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-597

Uniqueness validator instead of unique index

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • core, query
    • None

    Description

      We currently have a few unique indexes that ensure only one node may exist for a given node type / property name / property value combination (for example the jcr:uuid needs to be unique).

      While this works, I see some problems with this approach:

      • Indexes might be removed by an admin or they might not be available due to misconfiguration.
      • It (slightly) complicates the index implementation.
      • The index needs to do something that is not obvious (the index has to act like a constraint / validator). Updating an index can fail for different reasons that have a different meaning: updating the index might fail due to duplicate key (which is not recoverable), and it might fail due to a conflict (which is recoverable).

      Instead of using unique indexes, I propose to use a validator instead. The validator can internally run a query to check if such a value already exists.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            thomasm Thomas Mueller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment