Uploaded image for project: 'OpenDJ'
  1. OpenDJ
  2. OPENDJ-8000

Unindexed sorted search handled with a VLV index may miss the base entry

    XMLWordPrintable

Details

    • Bug
    • Status: Done
    • Critical
    • Resolution: Fixed
    • 6.0.0, 6.5.0, 7.0.0
    • 2021.6, 7.2.0
    • None

    Description

      Since 6.0, DS can handle unindexed sorted search with a VLV index, but the algorithm to determine whether the VLV index scope is a superset of the search is incorrect, see org.opends.server.backends.pluggable.VLVIndex#canSort

      If the VLV has scope subordinate-subtree and the search has scope whole-subtree, then the server will not return the base entry in the result.

      Steps to reproduce:

      ./opendj/setup \
                --instancePath ./opendj \
                --serverId Dode_Moriyama \
                --deploymentKeyPassword password \
                --rootUserDn uid=admin \
                --rootUserPassword password \
                --monitorUserDn uid=Monitor \
                --monitorUserPassword password \
                --hostname macgrady.local \
                --adminConnectorPort 4444 \
                --ldapPort 1389 \
                --ldapsPort 1636 \
                --httpsPort 8443 \
                --replicationPort 8989
      
      ./opendj/bin/setup-profile --profile ds-evaluation:7.0.0 --set ds-evaluation/generatedUsers:100000
      
      ./opendj/bin/dsconfig create-backend-vlv-index \
                --backend-name dsEvaluation \
                --set base-dn:ou=people,dc=example,dc=com \
                --set filter:"(&)" \
                --set scope:subordinate-subtree \
                --set sort-order:description \
                --type generic \
                --index-name people-by-description \
                --offline \
                --no-prompt
      
      ./opendj/bin/rebuild-index --baseDn dc=example,dc=com --index vlv.people-by-description --offline
      
      ./opendj/bin/start-ds
      
      ./opendj/bin/ldapsearch --bindDn "uid=admin" -w password -X -h localhost -p 1636 --useSsl --baseDn "ou=people,dc=example,dc=com" --searchScope sub --sortOrder description "(objectClass=*)" | less
      

      Actual result: The search result does not include the base entry.
      Expected result: The server should not use the VLV index because it does not contain the base entry and the search should fail with the following:

      # The LDAP search request failed: 12 (Unavailable Critical Extension)
      # Additional Information:  The search results cannot be sorted because the given search request is not indexed 

      Adding the same VLV index but with scope WHOLE_SUBTREE will make it possible to run the search:

      ./opendj/bin/dsconfig create-backend-vlv-index \
                --backend-name dsEvaluation \
                --set base-dn:ou=people,dc=example,dc=com \
                --set filter:"(&)" \
                --set scope:whole-subtree \
                --set sort-order:description \
                --type generic \
                --index-name people-by-description-whole-subtree \
                --offline \
                --no-prompt 

       

      Attachments

        Activity

          People

            ondrej.fuchsik Ondrej Fuchsik
            cyril.quinton Cyril Quinton [X] (Inactive)
            Cyril Quinton [X] Cyril Quinton [X] (Inactive)
            Ondrej Fuchsik Ondrej Fuchsik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: