Skip to content

Apache Lucene open-source search software

SOLR-346: Use perl regex to improve accuracy of finding latest snapshot in snapinstaller

William Au3962cb987e4b
diff --git a/CHANGES.txt b/CHANGES.txt
index c02abfa6268..979920b9a9a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -125,6 +125,8 @@ Bug Fixes
11. SOLR-872: Better error message for incorrect copyField destination (Noble Paul via shalin)
+12. SOLR-346: Use perl regex to improve accuracy of finding latest snapshot in snapinstaller (billa)
+
Other Changes
----------------------
diff --git a/src/scripts/snapinstaller b/src/scripts/snapinstaller
index ec94201e299..111ef37b2a3 100755
--- a/src/scripts/snapinstaller
+++ b/src/scripts/snapinstaller
@@ -110,7 +110,7 @@ logMessage started by $oldwhoami
logMessage command: $0 $@
# get directory name of latest snapshot
-name=`ls ${data_dir}|grep 'snapshot\.'|grep -v wip|sort -r|head -1`
+name=`perl -e 'chdir q|${data_dir}|; print ((sort grep {/^snapshot[.][1-9][0-9]{13}$/} <*>)[-1])'`
# clean up after INT/TERM
trap 'echo "caught INT/TERM, exiting now but partial installation may have already occured";/bin/rm -rf ${data_dir"/index.tmp$$;logExit aborted 13' INT TERM