Solr
  1. Solr
  2. SOLR-4682

CoreAdminRequest.mergeIndexes can not merge mutilple cores.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.2
    • Fix Version/s: 4.3, 6.0
    • Component/s: clients - java
    • Labels:
    • Environment:

      java version "1.6.0_20"

      Description

      The mergeIndexes method in CoreAdminRequest class accepts an array of srcCores, but it only merge the last core of array into targetCore. Related code as follows,

      CoreAdminRequest.java
      if (srcCores != null) {
      	for (String srcCore : srcCores) {
      		params.set(CoreAdminParams.SRC_CORE, srcCore);
      	}
      }
      

      The for-each loop above overrides the SRC_CORE value in params and only the last one reserved when loop ends.
      We should remove the for-each loop and set SRC_CORE value with an array of srcCores.
      The code above is in CoreAdminRequest class line 330

      1. SOLR-4682.patch
        3 kB
        Shalin Shekhar Mangar

        Activity

        Hide
        Shalin Shekhar Mangar added a comment -

        Jason, where is the code that you have put in the issue description? I see the following in CoreAdminRequest on branch 4.2:

         public static CoreAdminResponse mergeIndexes(String name,
              String[] indexDirs, String[] srcCores, SolrServer server) throws SolrServerException,
              IOException {
            CoreAdminRequest.MergeIndexes req = new CoreAdminRequest.MergeIndexes();
            req.setCoreName(name);
            req.setIndexDirs(Arrays.asList(indexDirs));
            req.setSrcCores(Arrays.asList(srcCores));
            return req.process(server);
          }
        
        Show
        Shalin Shekhar Mangar added a comment - Jason, where is the code that you have put in the issue description? I see the following in CoreAdminRequest on branch 4.2: public static CoreAdminResponse mergeIndexes( String name, String [] indexDirs, String [] srcCores, SolrServer server) throws SolrServerException, IOException { CoreAdminRequest.MergeIndexes req = new CoreAdminRequest.MergeIndexes(); req.setCoreName(name); req.setIndexDirs(Arrays.asList(indexDirs)); req.setSrcCores(Arrays.asList(srcCores)); return req.process(server); }
        Hide
        Shalin Shekhar Mangar added a comment -

        Ok, I see that code is in the class CoreAdminRequest.MergeIndexes. I'll fix.

        Show
        Shalin Shekhar Mangar added a comment - Ok, I see that code is in the class CoreAdminRequest.MergeIndexes. I'll fix.
        Hide
        Shalin Shekhar Mangar added a comment -

        Fix with a test.

        Show
        Shalin Shekhar Mangar added a comment - Fix with a test.
        Hide
        Shalin Shekhar Mangar added a comment -

        Fixed in trunk and branch_4x.

        Show
        Shalin Shekhar Mangar added a comment - Fixed in trunk and branch_4x.
        Hide
        Uwe Schindler added a comment -

        Closed after release.

        Show
        Uwe Schindler added a comment - Closed after release.

          People

          • Assignee:
            Shalin Shekhar Mangar
            Reporter:
            Jason.D.Cao
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development