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

ConcurrentUpdateSolrClient doesn't obey "collection" when streaming updates

    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 7.5
    • 7.6, 8.0
    • SolrJ
    • None

    Description

      ConcurrentUpdateSolrClient spins up background threads that pull documents from a queue and feed them into open HTTP connections.  Before writing each UpdateRequest on the connection, CUSC checks that the SolrParams match the params used when originally opening the connection.  But it doesn't check that the collection is the same.

      If a user is using the same ConcurrentUpdateSolrClient to send documents to multiple collections simultaneously, each of their UpdateRequest might go to the wrong collection entirely, based on what connections are already open.

      The problem can be reproduced with the snippet below.  The correct behavior would be for 500 docs to go to each collection.  But instead, on most runs all 1000 go to collection1.

      @Test
      public void cusc_test() throws Exception {
        try (SolrClient client = new ConcurrentUpdateSolrClient.Builder("http://localhost:8983/solr").build()) {
          for (int i = 0; i < 1000; i++) {
            SolrInputDocument doc = new SolrInputDocument();
            doc.setField("id", "value" + i);
            if (i%2 == 0) {
              client.add("collection1", doc);
            } else {
              client.add("collection2", doc);
            }
          }
      
          client.commit("collection1");
          client.commit("collection2");
        }
      }

      Attachments

        1. SOLR-12803.patch
          8 kB
          Jason Gerlowski
        2. SOLR-12803.patch
          8 kB
          Jason Gerlowski

        Activity

          People

            gerlowskija Jason Gerlowski
            gerlowskija Jason Gerlowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: