mirror of https://github.com/apache/lucene.git
workaround for cp not having the -l option on Solaris and OS X: SOLR-282
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@555612 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1fec553e28
commit
7a7d05c27b
|
@ -131,13 +131,18 @@ then
|
||||||
logExit failed 1
|
logExit failed 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check status of commit request
|
# check status of commit request - original format
|
||||||
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
|
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
|
||||||
if [[ $? != 0 ]]
|
if [[ $? != 0 ]]
|
||||||
then
|
then
|
||||||
logMessage commit request to Solr at ${curl_url} failed:
|
# check status of commit request - new format
|
||||||
logMessage $rs
|
echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1
|
||||||
logExit failed 2
|
if [[ $? != 0 ]]
|
||||||
|
then
|
||||||
|
logMessage commit request to Solr at ${curl_url} failed:
|
||||||
|
logMessage $rs
|
||||||
|
logExit failed 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# successful commit creates a snapshot file synchronously
|
# successful commit creates a snapshot file synchronously
|
||||||
|
@ -170,7 +175,16 @@ trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_d
|
||||||
|
|
||||||
# make a backup using hard links into temporary location
|
# make a backup using hard links into temporary location
|
||||||
# then move it into place atomically
|
# then move it into place atomically
|
||||||
cp -lr ${lastsnap} ${data_dir}/${temp}
|
if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" ]]
|
||||||
|
then
|
||||||
|
orig_dir=$(pwd)
|
||||||
|
mkdir ${data_dir}/${temp}
|
||||||
|
cd ${lastsnap}
|
||||||
|
find . -print|cpio -pdlmu ${data_dir}/${temp} 1>/dev/null 2>&1
|
||||||
|
cd ${orig_dir}
|
||||||
|
else
|
||||||
|
cp -lr ${lastsnap} ${data_dir}/${temp}
|
||||||
|
fi
|
||||||
mv ${data_dir}/${temp} ${data_dir}/${name}
|
mv ${data_dir}/${temp} ${data_dir}/${name}
|
||||||
|
|
||||||
logExit ended 0
|
logExit ended 0
|
||||||
|
|
|
@ -131,13 +131,18 @@ then
|
||||||
logExit failed 1
|
logExit failed 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check status of optimize request
|
# check status of optimize request - original format
|
||||||
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
|
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
|
||||||
if [[ $? != 0 ]]
|
if [[ $? != 0 ]]
|
||||||
then
|
then
|
||||||
logMessage optimize request to Solr at ${curl_url} failed:
|
# check status of optimize request - new format
|
||||||
logMessage $rs
|
echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1
|
||||||
logExit failed 2
|
if [[ $? != 0 ]]
|
||||||
|
then
|
||||||
|
logMessage optimize request to Solr at ${curl_url} failed:
|
||||||
|
logMessage $rs
|
||||||
|
logExit failed 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# successful optimize creates a snapshot file synchronously
|
# successful optimize creates a snapshot file synchronously
|
||||||
|
@ -170,7 +175,16 @@ trap 'echo cleaning up, please wait ...;/bin/rm -rf ${data_dir}/${name} ${data_d
|
||||||
|
|
||||||
# make a backup using hard links into temporary location
|
# make a backup using hard links into temporary location
|
||||||
# then move it into place atomically
|
# then move it into place atomically
|
||||||
cp -lr ${lastsnap} ${data_dir}/${temp}
|
if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" ]]
|
||||||
|
then
|
||||||
|
orig_dir=$(pwd)
|
||||||
|
mkdir ${data_dir}/${temp}
|
||||||
|
cd ${lastsnap}
|
||||||
|
find . -print|cpio -pdlmu ${data_dir}/${temp} 1>/dev/null 2>&1
|
||||||
|
cd ${orig_dir}
|
||||||
|
else
|
||||||
|
cp -lr ${lastsnap} ${data_dir}/${temp}
|
||||||
|
fi
|
||||||
mv ${data_dir}/${temp} ${data_dir}/${name}
|
mv ${data_dir}/${temp} ${data_dir}/${name}
|
||||||
|
|
||||||
logExit ended 0
|
logExit ended 0
|
||||||
|
|
|
@ -101,7 +101,16 @@ logMessage making backup ${data_dir}/${name}
|
||||||
|
|
||||||
# make a backup using hard links into temporary location
|
# make a backup using hard links into temporary location
|
||||||
# then move it into place atomically
|
# then move it into place atomically
|
||||||
cp -lr ${data_dir}/index ${data_dir}/${temp}
|
if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" ]]
|
||||||
|
then
|
||||||
|
orig_dir=$(pwd)
|
||||||
|
mkdir ${data_dir}/${temp}
|
||||||
|
cd ${data_dir}/index
|
||||||
|
find . -print|cpio -pdlmu ${data_dir}/${temp} 1>/dev/null 2>&1
|
||||||
|
cd ${orig_dir}
|
||||||
|
else
|
||||||
|
cp -lr ${data_dir}/index ${data_dir}/${temp}
|
||||||
|
fi
|
||||||
mv ${data_dir}/${temp} ${data_dir}/${name}
|
mv ${data_dir}/${temp} ${data_dir}/${name}
|
||||||
|
|
||||||
logExit ended 0
|
logExit ended 0
|
||||||
|
|
|
@ -116,13 +116,18 @@ then
|
||||||
logExit failed 1
|
logExit failed 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check status of commit request
|
# check status of commit request - original format
|
||||||
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
|
echo $rs | grep '<result.*status="0"' > /dev/null 2>&1
|
||||||
if [[ $? != 0 ]]
|
if [[ $? != 0 ]]
|
||||||
then
|
then
|
||||||
logMessage commit request to Solr at ${curl_url} failed:
|
# check status of commit request - new format
|
||||||
logMessage $rs
|
echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1
|
||||||
logExit failed 2
|
if [[ $? != 0 ]]
|
||||||
|
then
|
||||||
|
logMessage commit request to Solr at ${curl_url} failed:
|
||||||
|
logMessage $rs
|
||||||
|
logExit failed 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logExit ended 0
|
logExit ended 0
|
||||||
|
|
|
@ -117,13 +117,18 @@ then
|
||||||
logExit failed 1
|
logExit failed 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check status of optimize request
|
# check status of optimize request - original format
|
||||||
rc=`echo $rs|cut -f2 -d'"'`
|
rc=`echo $rs|cut -f2 -d'"'`
|
||||||
if [[ $? != 0 ]]
|
if [[ $? != 0 ]]
|
||||||
then
|
then
|
||||||
logMessage optimize request to Solr at ${curl_url} failed:
|
# check status of optimize request - new format
|
||||||
logMessage $rs
|
echo $rs | grep '<lst name="responseHeader"><int name="status">0</int>' > /dev/null 2>&1
|
||||||
logExit failed 2
|
if [[ $? != 0 ]]
|
||||||
|
then
|
||||||
|
logMessage optimize request to Solr at ${curl_url} failed:
|
||||||
|
logMessage $rs
|
||||||
|
logExit failed 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logExit ended 0
|
logExit ended 0
|
||||||
|
|
|
@ -21,6 +21,7 @@ export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
|
||||||
|
|
||||||
# set up variables
|
# set up variables
|
||||||
prog=${0##*/}
|
prog=${0##*/}
|
||||||
|
OS=`uname`
|
||||||
|
|
||||||
# source the config file if present
|
# source the config file if present
|
||||||
confFile=${solr_root}/conf/scripts.conf
|
confFile=${solr_root}/conf/scripts.conf
|
||||||
|
|
|
@ -141,9 +141,20 @@ fi
|
||||||
# install using hard links into temporary directory
|
# install using hard links into temporary directory
|
||||||
# remove original index and then atomically copy new one into place
|
# remove original index and then atomically copy new one into place
|
||||||
logMessage installing snapshot ${name}
|
logMessage installing snapshot ${name}
|
||||||
cp -lr ${name}/ ${data_dir}/index.tmp$$ && \
|
if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" ]]
|
||||||
/bin/rm -rf ${data_dir}/index && \
|
then
|
||||||
mv -f ${data_dir}/index.tmp$$ ${data_dir}/index
|
orig_dir=$(pwd)
|
||||||
|
mkdir ${data_dir}/index.tmp$$ && \
|
||||||
|
cd ${name} && \
|
||||||
|
find . -print|cpio -pdlmu ${data_dir}/index.tmp$$ 1>/dev/null 2>&1 && \
|
||||||
|
/bin/rm -rf ${data_dir}/index && \
|
||||||
|
mv -f ${data_dir}/index.tmp$$ ${data_dir}/index
|
||||||
|
cd ${orig_dir}
|
||||||
|
else
|
||||||
|
cp -lr ${name}/ ${data_dir}/index.tmp$$ && \
|
||||||
|
/bin/rm -rf ${data_dir}/index && \
|
||||||
|
mv -f ${data_dir}/index.tmp$$ ${data_dir}/index
|
||||||
|
fi
|
||||||
|
|
||||||
# update distribution stats
|
# update distribution stats
|
||||||
echo ${name} > ${solr_root}/logs/snapshot.current
|
echo ${name} > ${solr_root}/logs/snapshot.current
|
||||||
|
|
|
@ -200,7 +200,16 @@ fi
|
||||||
# take a snapshot of current index so that only modified files will be rsync-ed
|
# take a snapshot of current index so that only modified files will be rsync-ed
|
||||||
# put the snapshot in the 'work-in-progress" directory to prevent it from
|
# put the snapshot in the 'work-in-progress" directory to prevent it from
|
||||||
# being installed while the copying is still in progress
|
# being installed while the copying is still in progress
|
||||||
cp -lr ${data_dir}/index ${data_dir}/${name}-wip
|
if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" ]]
|
||||||
|
then
|
||||||
|
orig_dir=$(pwd)
|
||||||
|
mkdir ${data_dir}/${name}-wip
|
||||||
|
cd ${data_dir}/index
|
||||||
|
find . -print|cpio -pdlmu ${data_dir}/${name}-wip 1>/dev/null 2>&1
|
||||||
|
cd ${orig_dir}
|
||||||
|
else
|
||||||
|
cp -lr ${data_dir}/index ${data_dir}/${name}-wip
|
||||||
|
fi
|
||||||
# force rsync of segments and .del files since we are doing size-only
|
# force rsync of segments and .del files since we are doing size-only
|
||||||
if [[ -n ${sizeonly} ]]
|
if [[ -n ${sizeonly} ]]
|
||||||
then
|
then
|
||||||
|
|
|
@ -102,7 +102,16 @@ logMessage taking snapshot ${name}
|
||||||
|
|
||||||
# take a snapshot using hard links into temporary location
|
# take a snapshot using hard links into temporary location
|
||||||
# then move it into place atomically
|
# then move it into place atomically
|
||||||
cp -lr ${data_dir}/index ${temp}
|
if [[ "${OS}" == "SunOS" || "${OS}" == "Darwin" ]]
|
||||||
|
then
|
||||||
|
orig_dir=$(pwd)
|
||||||
|
mkdir ${temp}
|
||||||
|
cd ${data_dir}/index
|
||||||
|
find . -print|cpio -pdlmu ${temp} 1>/dev/null 2>&1
|
||||||
|
cd ${orig_dir}
|
||||||
|
else
|
||||||
|
cp -lr ${data_dir}/index ${temp}
|
||||||
|
fi
|
||||||
mv ${temp} ${name}
|
mv ${temp} ${name}
|
||||||
|
|
||||||
logExit ended 0
|
logExit ended 0
|
||||||
|
|
Loading…
Reference in New Issue