Solr
  1. Solr
  2. SOLR-2046

add a function to set curl_url in scripts-util

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.4.1
    • Fix Version/s: 3.1, 4.0-ALPHA
    • Component/s: replication (scripts)
    • Labels:
      None

      Description

      abc/abo/commit/optimize/readercycle scripts have the following identical snippet to set curl_url:

      if [[ -n ${solr_url} ]]
      then
        curl_url=${solr_url}
      else
        if [[ -z ${solr_port} ]]
        then
          echo "Solr port number missing in $confFile or command line."
          echo "$USAGE"
          exit 1
        fi
      
        # use default hostname if not specified
        if [[ -z ${solr_hostname} ]]
        then
          solr_hostname=localhost
        fi
      
        # use default webapp name if not specified
        if [[ -z ${webapp_name} ]]
        then
          webapp_name=solr
        fi
        curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update
      fi
      

      I think it should be moved to scripts-util in order to improve readability/maintainability.

      1. SOLR-2046.patch
        19 kB
        Koji Sekiguchi
      2. SOLR-2046.patch
        19 kB
        Koji Sekiguchi
      3. SOLR-2046.patch
        17 kB
        Koji Sekiguchi
      4. SOLR-2046.patch
        8 kB
        Koji Sekiguchi

        Activity

        Hide
        Koji Sekiguchi added a comment -

        Attached the patch. I moved above common snippet to scripts-url as a function curlUrl. I did some minor fix (typo in help massage, remove shell var that never used). Worked well on my Mac.

        BTW, I realized that readercycle script is almost same as commit and it is somewhat old? Because the check code of commit request is:

        # check status of commit request                                                
        echo $rs | grep '<response.*status="0"' > /dev/null 2>&1
          :
        

        but in commit script, the check code is:

        # check status of commit request - original format                              
        echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
          :
        

        readercycle sees "<response status="0">" while commit sees "<result status="0">"... And commit script then check "new format xml" but readercycle never check "new format". So, readercycle always fails (I made fix it in the patch).

        Can we delete readercycle? Or am I missing something?

        Show
        Koji Sekiguchi added a comment - Attached the patch. I moved above common snippet to scripts-url as a function curlUrl. I did some minor fix (typo in help massage, remove shell var that never used). Worked well on my Mac. BTW, I realized that readercycle script is almost same as commit and it is somewhat old? Because the check code of commit request is: # check status of commit request echo $rs | grep '<response.*status= "0" ' > /dev/ null 2>&1 : but in commit script, the check code is: # check status of commit request - original format echo $rs | grep '<result.*status= "0" ' > /dev/ null 2>&1 : readercycle sees "< response status="0">" while commit sees "< result status="0">"... And commit script then check "new format xml" but readercycle never check "new format". So, readercycle always fails (I made fix it in the patch). Can we delete readercycle? Or am I missing something?
        Hide
        Koji Sekiguchi added a comment -

        New patch attached. I added a function dataDir for the following common snippet:

        # use default value for data_dir if not specified                               
        # relative path starts at ${solr_root}                                          
        if [[ -z ${data_dir} ]]
        then
            data_dir=${solr_root}/data
        elif [[ "`echo ${data_dir}|cut -c1`" != "/" ]]
        then
            data_dir=${solr_root}/${data_dir}
        fi
        

        Also further minor fix typo added in help messages.

        Show
        Koji Sekiguchi added a comment - New patch attached. I added a function dataDir for the following common snippet: # use default value for data_dir if not specified # relative path starts at ${solr_root} if [[ -z ${data_dir} ]] then data_dir=${solr_root}/data elif [[ "`echo ${data_dir}|cut -c1`" != "/" ]] then data_dir=${solr_root}/${data_dir} fi Also further minor fix typo added in help messages.
        Hide
        Koji Sekiguchi added a comment -

        A new patch attached. In this patch, I'm going to remove readercycle script. I'll commit in a few days.

        Show
        Koji Sekiguchi added a comment - A new patch attached. In this patch, I'm going to remove readercycle script. I'll commit in a few days.
        Hide
        Koji Sekiguchi added a comment -

        trunk: Committed revision 990160.
        branch_3x: Committed revision 990162.

        Show
        Koji Sekiguchi added a comment - trunk: Committed revision 990160. branch_3x: Committed revision 990162.
        Hide
        Grant Ingersoll added a comment -

        Bulk close for 3.1.0 release

        Show
        Grant Ingersoll added a comment - Bulk close for 3.1.0 release

          People

          • Assignee:
            Koji Sekiguchi
            Reporter:
            Koji Sekiguchi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development