Solr
  1. Solr
  2. SOLR-346

need to improve snapinstaller to ignore non-snapshots in data directory

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2, 1.3
    • Fix Version/s: 1.4
    • Component/s: replication (scripts)
    • Labels:
      None

      Description

      http://www.mail-archive.com/solr-user@lucene.apache.org/msg05734.html

      > latest snapshot /opt/solr/data/temp-snapshot.20070816120113 already
      > installed

      A directory in the Solr data directory is causing snapinstaller to fail. Snapinstaller should be improved to ignore any much non-snapshot as possible. It can use a regular expression to look for snapshot.dddddddddddddd where d is a digit.

      1. solr-346.patch
        0.6 kB
        Bill Au
      2. solr-346-2.patch
        0.7 kB
        Bill Au

        Activity

        Hide
        Bill Au added a comment -

        snappuller has the same problem. See SOLR-830 (https://issues.apache.org/jira/browse/SOLR-830) for details. The proposed solution there should work here also.

        Show
        Bill Au added a comment - snappuller has the same problem. See SOLR-830 ( https://issues.apache.org/jira/browse/SOLR-830 ) for details. The proposed solution there should work here also.
        Hide
        Bill Au added a comment -

        patch to use perl regular expression to improve accuracy in finding latest snapshot.

        Show
        Bill Au added a comment - patch to use perl regular expression to improve accuracy in finding latest snapshot.
        Hide
        Bill Au added a comment -

        Patch committed:

        Sending CHANGES.txt
        Sending src/scripts/snapinstaller
        Transmitting file data ..
        Committed revision 719232.

        Show
        Bill Au added a comment - Patch committed: Sending CHANGES.txt Sending src/scripts/snapinstaller Transmitting file data .. Committed revision 719232.
        Hide
        Jason Wambach added a comment -

        The patched line should be:

        name=`perl -e 'chdir q|'$

        {data_dir}'|; print ((sort grep {/^snapshot[.][1-9][0-9]{13}$/} <*>)[-1])'`

        not

        name=`perl -e 'chdir q|${data_dir}

        |; print ((sort grep {/^snapshot[.][1-9][0-9]

        {13}

        $/} <*>)[-1])'`

        The latter will not properly evaluate the data_dir env variable.

        Show
        Jason Wambach added a comment - The patched line should be: name=`perl -e 'chdir q|'$ {data_dir}'|; print ((sort grep {/^snapshot [.] [1-9] [0-9] {13}$/} <*>) [-1] )'` not name=`perl -e 'chdir q|${data_dir} |; print ((sort grep {/^snapshot [.] [1-9] [0-9] {13} $/} <*>) [-1] )'` The latter will not properly evaluate the data_dir env variable.
        Hide
        Steve Rowe added a comment -

        Jason, I think you're right.

        The following script:

        #!/bin/bash
        data_dir=something
        name=`perl -e 'print q|${data_dir}|;'`
        echo "As it is: $name"
        name=`perl -e 'print q|'${data_dir}'|;'`
        echo "As you would have it: $name"
        

        Produces this output:

        As it is: ${data_dir}
        As you would have it: something
        
        Show
        Steve Rowe added a comment - Jason, I think you're right. The following script: #!/bin/bash data_dir=something name=`perl -e 'print q|${data_dir}|;'` echo "As it is: $name" name=`perl -e 'print q|'${data_dir}'|;'` echo "As you would have it: $name" Produces this output: As it is: ${data_dir} As you would have it: something
        Hide
        Steve Rowe added a comment - - edited

        BTW, I tested the similar change made to snappuller under SOLR-830, and it does not have the same interpolation issue:

        snap_name=`ssh -o StrictHostKeyChecking=no ${master_host} \
        "perl -e 'chdir q|${master_data_dir}|; print ((sort grep {/^snapshot[.][1-9][0-9]{13}$/} <*>)[-1])'"`
        

        Since the shell script containing the perl script is enclosed in double quotes, $

        {master_data_dir}

        is properly interpolated before perl sees it.

        Show
        Steve Rowe added a comment - - edited BTW, I tested the similar change made to snappuller under SOLR-830 , and it does not have the same interpolation issue: snap_name=`ssh -o StrictHostKeyChecking=no ${master_host} \ "perl -e 'chdir q|${master_data_dir}|; print ((sort grep {/^snapshot[.][1-9][0-9]{13}$/} <*>)[-1])'" ` Since the shell script containing the perl script is enclosed in double quotes, $ {master_data_dir} is properly interpolated before perl sees it.
        Hide
        Bill Au added a comment -

        attaching new patch to fix snapinstaller

        Show
        Bill Au added a comment - attaching new patch to fix snapinstaller
        Hide
        Bill Au added a comment -

        I went ahead and committed the code change:

        Sending snapinstaller
        Transmitting file data .
        Committed revision 750048.

        Show
        Bill Au added a comment - I went ahead and committed the code change: Sending snapinstaller Transmitting file data . Committed revision 750048.
        Hide
        Grant Ingersoll added a comment -

        Bulk close for Solr 1.4

        Show
        Grant Ingersoll added a comment - Bulk close for Solr 1.4

          People

          • Assignee:
            Bill Au
            Reporter:
            Bill Au
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development