Hi,

This seems alright as it leaves the current index in place, doesn't mess with 
the spellchecker and leave the properties alone. But, there are two problems:

1. it doesn't take into account the commitsToKeep value set in the deletion 
policy, and;
2. it will remove any directory to which a current downloading replication is 
targetted to.

Issue 1 may not be a big issue as most users leave only one commit on disk but 
2 is a real problem in master/slave architectures.

Cheers,

> There is a bug that leaves old index.* directories in the Solr data
> directory.
> 
> Here is a script that will clean it up. I wanted to make sure this is
> okay, without doing a core reload.
> 
> Thanks.
> 
> #!/bin/bash
> 
> DIR="/mnt/servers/solr/data"
> LIST=`ls $DIR`
> INDEX=`cat $DIR/index.properties | grep index\= | awk 'BEGIN { FS =
> "=" } ; { print $2 }'`
> echo $INDEX
> 
> for file in  $LIST
> do
>         if [ $INDEX == $file -o $file == "index" -o $file ==
> "index.properties" -o $file == "replication.properties" -o $file ==
> "spellchecker" ]
>         then
>                 echo "skip: $file"
>         else
>                 echo "rm -rf $DIR/$file"
>                 rm -rf $DIR/$file
>         fi
> done

Reply via email to