Solr
  1. Solr
  2. SOLR-6073

Change CollectionAdminRequest to deprecate helper wrappers and move towards Builder design for CollectionsAPI calls

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.8
    • Fix Version/s: 5.0, 6.0
    • Component/s: clients - java, SolrCloud
    • Labels:
      None

      Description

      In the process also cleanup the following: The CollectionAdminRequest has a createCollection() method which has the following hard-coded:

      req.setRouterName("implicit");
      

      This is a bug and we should remove it.

      1. SOLR-6073.patch
        32 kB
        Anshum Gupta
      2. SOLR-6073.patch
        32 kB
        Anshum Gupta
      3. SOLR-6073-4x.patch
        28 kB
        Anshum Gupta
      4. SOLR-6073-4x.patch
        32 kB
        Anshum Gupta

        Issue Links

          Activity

          Hide
          Noble Paul added a comment -

          There are 8 overloaded methods for createcollection. We should just get rid of all of them and make users pass the Create Obect to a single createCollection method

          Show
          Noble Paul added a comment - There are 8 overloaded methods for createcollection. We should just get rid of all of them and make users pass the Create Obect to a single createCollection method
          Hide
          Shalin Shekhar Mangar added a comment -

          Actually, a Create class already exists inside CollectionAdminRequest.

          Show
          Shalin Shekhar Mangar added a comment - Actually, a Create class already exists inside CollectionAdminRequest.
          Hide
          Varun Thacker added a comment -

          There are a few createCollection methods with hardcoded router="compositeId' also.

          Would this be a correct approach going forward ?

          Rename Create to CreateCollection which takes the collection name and the remaining params can be set using the setters.
          Then have users create the CreateCollection object and the call req.process(server);

          Something like -

          CreateCollection req = new CreateCollection("collection1");
          req.setConfigName("");
          ...
          req.process(server)
          

          We could then deprecate all the createCollection methods in 4.x

          Show
          Varun Thacker added a comment - There are a few createCollection methods with hardcoded router="compositeId' also. Would this be a correct approach going forward ? Rename Create to CreateCollection which takes the collection name and the remaining params can be set using the setters. Then have users create the CreateCollection object and the call req.process(server); Something like - CreateCollection req = new CreateCollection("collection1"); req.setConfigName(""); ... req.process(server) We could then deprecate all the createCollection methods in 4.x
          Hide
          Shalin Shekhar Mangar added a comment -

          I don't think there's a need to rename the Create class. It's unnecessary back-compat break. Removing the N create methods is enough.

          Show
          Shalin Shekhar Mangar added a comment - I don't think there's a need to rename the Create class. It's unnecessary back-compat break. Removing the N create methods is enough.
          Hide
          Varun Thacker added a comment -

          Removing the N create methods is enough.

          This would be done on both trunk and branch_4x?

          Show
          Varun Thacker added a comment - Removing the N create methods is enough. This would be done on both trunk and branch_4x?
          Hide
          Anshum Gupta added a comment -

          Moving the patch from the parent issue to here.
          Patches for trunk and 4x that do the following:

          • Deprecate the current createCollection(tons and tons of arguments), splitShard and all other such collections in branch_4x.
          • Remove all of the above mentioned methods in trunk.
          New usage
          // New usage for Create collection
          Create createCollectionRequest = new Create();
          createCollectionRequest.setCollectionName(collectionName);
          .
          .
          CollectionAdminResponse response = createCollectionRequest.process(server);
          
          // New usage for splitShard
          SplitShard splitShardRequest = new SplitShard();
          splitShardRequest.setCollectionName(collectionName);
          splitShardRequest.setShardName(shardName);
          response = splitShardRequest.process(server);
          
          // New usage for REQUESTSTATUS
          RequestStatus request = new RequestStatus();
          request.setRequestId(requestId);
          response = request.process(server);
          
          Show
          Anshum Gupta added a comment - Moving the patch from the parent issue to here. Patches for trunk and 4x that do the following: Deprecate the current createCollection(tons and tons of arguments), splitShard and all other such collections in branch_4x. Remove all of the above mentioned methods in trunk. New usage // New usage for Create collection Create createCollectionRequest = new Create(); createCollectionRequest.setCollectionName(collectionName); . . CollectionAdminResponse response = createCollectionRequest.process(server); // New usage for splitShard SplitShard splitShardRequest = new SplitShard(); splitShardRequest.setCollectionName(collectionName); splitShardRequest.setShardName(shardName); response = splitShardRequest.process(server); // New usage for REQUESTSTATUS RequestStatus request = new RequestStatus(); request.setRequestId(requestId); response = request.process(server);
          Hide
          Anshum Gupta added a comment -

          Newer patches.

          I have just deprecated the methods for branch_4x and changed all usages to confirm to the non-deprecated calls.
          The trunk patch just cleans up all these methods and also confirms to the non-deprecated calls.

          Show
          Anshum Gupta added a comment - Newer patches. I have just deprecated the methods for branch_4x and changed all usages to confirm to the non-deprecated calls. The trunk patch just cleans up all these methods and also confirms to the non-deprecated calls.
          Hide
          ASF subversion and git services added a comment -

          Commit 1622121 from Anshum Gupta in branch 'dev/trunk'
          [ https://svn.apache.org/r1622121 ]

          SOLR-6073: Deprecate helper methods for CollectionsAPI SolrJ calls. Move towards using builder design for the calls.

          Show
          ASF subversion and git services added a comment - Commit 1622121 from Anshum Gupta in branch 'dev/trunk' [ https://svn.apache.org/r1622121 ] SOLR-6073 : Deprecate helper methods for CollectionsAPI SolrJ calls. Move towards using builder design for the calls.
          Hide
          ASF subversion and git services added a comment -

          Commit 1622126 from Anshum Gupta in branch 'dev/branches/branch_4x'
          [ https://svn.apache.org/r1622126 ]

          SOLR-6073: Deprecate helper methods for CollectionsAPI SolrJ calls. Move towards using builder design for the calls.

          Show
          ASF subversion and git services added a comment - Commit 1622126 from Anshum Gupta in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1622126 ] SOLR-6073 : Deprecate helper methods for CollectionsAPI SolrJ calls. Move towards using builder design for the calls.
          Hide
          ASF subversion and git services added a comment -

          Commit 1622129 from Anshum Gupta in branch 'dev/trunk'
          [ https://svn.apache.org/r1622129 ]

          SOLR-6073: Adding names to CHANGES.txt

          Show
          ASF subversion and git services added a comment - Commit 1622129 from Anshum Gupta in branch 'dev/trunk' [ https://svn.apache.org/r1622129 ] SOLR-6073 : Adding names to CHANGES.txt
          Hide
          ASF subversion and git services added a comment -

          Commit 1622131 from Anshum Gupta in branch 'dev/branches/branch_4x'
          [ https://svn.apache.org/r1622131 ]

          SOLR-6073: Adding names to CHANGES.txt

          Show
          ASF subversion and git services added a comment - Commit 1622131 from Anshum Gupta in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1622131 ] SOLR-6073 : Adding names to CHANGES.txt
          Hide
          Anshum Gupta added a comment -

          Bulk close after 5.0 release.

          Show
          Anshum Gupta added a comment - Bulk close after 5.0 release.

            People

            • Assignee:
              Anshum Gupta
              Reporter:
              Shalin Shekhar Mangar
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development