Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9309

SolrCloud RTG with multiple "id" params has inconsistent behavior if only 0 or 1 ids are returned

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2, master (7.0)
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      • RTG uses a diff reqponse format depending on whether a single id is requested or multiple ids are requested.
      • there are 2 ways to request multiple ids:
        1. multiple id params
        2. comma seperated ids in one (or more) ids param(s)

      But in cloud mode, asking for multiple ids using the first method can incorrectly return the "single" doc response structure if 0 or 1 docs are returned (ie: because the other doc(s) don't exist in the index or were deleted).

      This inconsistency does not seem to exist in single node solr RTG

      (Example to follow in comment)

      1. SOLR-9309.patch
        9 kB
        Hoss Man
      2. SOLR-9309.patch
        9 kB
        Hoss Man

        Issue Links

          Activity

          Hide
          hossman Hoss Man added a comment -

          Example of problem...

          bin/solr -e cloud -noprompt

          If you have 2 docs that exist in a cloud setup, you get a "doclist" structure in the response, regardless of which param syntax you use to request both of them (this is consistent with single node solr) ...

          $ curl 'http://localhost:8983/solr/gettingstarted/get?ids=xxx,yyy'
          {
            "response":{"numFound":2,"start":0,"docs":[
                {
                  "id":"yyy",
                  "aaa_i":-459637688,
                  "_version_":1539876677329354752},
                {
                  "id":"xxx",
                  "aaa_i":1532757419,
                  "_version_":1539876677341937664}]
            }}
          $ curl 'http://localhost:8983/solr/gettingstarted/get?id=xxx&id=yyy'
          {
            "response":{"numFound":2,"start":0,"docs":[
                {
                  "id":"yyy",
                  "aaa_i":-459637688,
                  "_version_":1539876677329354752},
                {
                  "id":"xxx",
                  "aaa_i":1532757419,
                  "_version_":1539876677341937664}]
            }}
          

          if 1 of the ids requested do not exist in the collection, SolrCloud's RTG response structure becomes inconsistent depending on which param syntax you used – using multiple id params behaves as if only one doc was requested...

          $ curl 'http://localhost:8983/solr/gettingstarted/get?ids=xxx,bogus1'
          {
            "response":{"numFound":1,"start":0,"docs":[
                {
                  "id":"xxx",
                  "aaa_i":1532757419,
                  "_version_":1539876677341937664}]
            }}
          $ curl 'http://localhost:8983/solr/gettingstarted/get?ids=bogus2,bogus1'
          {
            "response":{"numFound":0,"start":0,"docs":[]
            }}
          $ curl 'http://localhost:8983/solr/gettingstarted/get?id=xxx&id=bogus1'
          {
            "doc":
            {
              "id":"xxx",
              "aaa_i":1532757419,
              "_version_":1539876677341937664}}
          $ curl 'http://localhost:8983/solr/gettingstarted/get?id=bogus2&id=bogus1'
          {
            "doc":null}
          
          Show
          hossman Hoss Man added a comment - Example of problem... bin/solr -e cloud -noprompt If you have 2 docs that exist in a cloud setup, you get a "doclist" structure in the response, regardless of which param syntax you use to request both of them (this is consistent with single node solr) ... $ curl 'http://localhost:8983/solr/gettingstarted/get?ids=xxx,yyy' { "response":{"numFound":2,"start":0,"docs":[ { "id":"yyy", "aaa_i":-459637688, "_version_":1539876677329354752}, { "id":"xxx", "aaa_i":1532757419, "_version_":1539876677341937664}] }} $ curl 'http://localhost:8983/solr/gettingstarted/get?id=xxx&id=yyy' { "response":{"numFound":2,"start":0,"docs":[ { "id":"yyy", "aaa_i":-459637688, "_version_":1539876677329354752}, { "id":"xxx", "aaa_i":1532757419, "_version_":1539876677341937664}] }} if 1 of the ids requested do not exist in the collection, SolrCloud's RTG response structure becomes inconsistent depending on which param syntax you used – using multiple id params behaves as if only one doc was requested... $ curl 'http://localhost:8983/solr/gettingstarted/get?ids=xxx,bogus1' { "response":{"numFound":1,"start":0,"docs":[ { "id":"xxx", "aaa_i":1532757419, "_version_":1539876677341937664}] }} $ curl 'http://localhost:8983/solr/gettingstarted/get?ids=bogus2,bogus1' { "response":{"numFound":0,"start":0,"docs":[] }} $ curl 'http://localhost:8983/solr/gettingstarted/get?id=xxx&id=bogus1' { "doc": { "id":"xxx", "aaa_i":1532757419, "_version_":1539876677341937664}} $ curl 'http://localhost:8983/solr/gettingstarted/get?id=bogus2&id=bogus1' { "doc":null}
          Hide
          hossman Hoss Man added a comment -

          Suggested fix:

          • refactors duplicated "param parsing" & "add doc/list to response" logic into helper methods
            • this refactoring keeps the "single node" logic on the doc vs list choice, resolving the current inconsistencies
          • enables some (previously commented out) logic in TestRandomFlRTGCloud to assert that we get a list when we expect a list – even if some/all of the ids requested don't exist.
          Show
          hossman Hoss Man added a comment - Suggested fix: refactors duplicated "param parsing" & "add doc/list to response" logic into helper methods this refactoring keeps the "single node" logic on the doc vs list choice, resolving the current inconsistencies enables some (previously commented out) logic in TestRandomFlRTGCloud to assert that we get a list when we expect a list – even if some/all of the ids requested don't exist.
          Hide
          hossman Hoss Man added a comment -

          small tweak: remove some redundant calls to SolrParam.getParams that i overlooked in previous patch.

          Show
          hossman Hoss Man added a comment - small tweak: remove some redundant calls to SolrParam.getParams that i overlooked in previous patch.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit acbe59c70cf862c4f3c452c37e05061e1c939c04 in lucene-solr's branch refs/heads/branch_6x from Chris Hostetter
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=acbe59c ]

          SOLR-9309: Fix SolrCloud RTG response structure when multi ids requested but only 1 found

          (cherry picked from commit 9aa639d45e31059bb2910dade6d7728ea075cd57)

          Show
          jira-bot ASF subversion and git services added a comment - Commit acbe59c70cf862c4f3c452c37e05061e1c939c04 in lucene-solr's branch refs/heads/branch_6x from Chris Hostetter [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=acbe59c ] SOLR-9309 : Fix SolrCloud RTG response structure when multi ids requested but only 1 found (cherry picked from commit 9aa639d45e31059bb2910dade6d7728ea075cd57)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9aa639d45e31059bb2910dade6d7728ea075cd57 in lucene-solr's branch refs/heads/master from Chris Hostetter
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9aa639d ]

          SOLR-9309: Fix SolrCloud RTG response structure when multi ids requested but only 1 found

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9aa639d45e31059bb2910dade6d7728ea075cd57 in lucene-solr's branch refs/heads/master from Chris Hostetter [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9aa639d ] SOLR-9309 : Fix SolrCloud RTG response structure when multi ids requested but only 1 found
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9aa639d45e31059bb2910dade6d7728ea075cd57 in lucene-solr's branch refs/heads/apiv2 from Chris Hostetter
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9aa639d ]

          SOLR-9309: Fix SolrCloud RTG response structure when multi ids requested but only 1 found

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9aa639d45e31059bb2910dade6d7728ea075cd57 in lucene-solr's branch refs/heads/apiv2 from Chris Hostetter [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9aa639d ] SOLR-9309 : Fix SolrCloud RTG response structure when multi ids requested but only 1 found
          Hide
          mikemccand Michael McCandless added a comment -

          Bulk close resolved issues after 6.2.0 release.

          Show
          mikemccand Michael McCandless added a comment - Bulk close resolved issues after 6.2.0 release.

            People

            • Assignee:
              hossman Hoss Man
              Reporter:
              hossman Hoss Man
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development