merge #3464 from 1.0

git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1198843 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2011-11-07 17:58:56 +00:00
parent b79ea7de10
commit adac1e680b
4 changed files with 1 additions and 47 deletions

View File

@ -1623,30 +1623,6 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
return CompactionManager.instance.submitTruncate(this, truncatedAt);
}
// if this errors out, we are in a world of hurt.
public void renameSSTables(String newCfName) throws IOException
{
// complete as much of the job as possible. Don't let errors long the way prevent as much renaming as possible
// from happening.
IOException mostRecentProblem = null;
for (File existing : DefsTable.getFiles(table.name, columnFamily))
{
try
{
String newFileName = existing.getName().replaceFirst("\\w+-", newCfName + "-");
FileUtils.renameWithConfirm(existing, new File(existing.getParent(), newFileName));
}
catch (IOException ex)
{
mostRecentProblem = ex;
}
}
if (mostRecentProblem != null)
throw new IOException("One or more IOExceptions encountered while renaming files. Most recent problem is included.", mostRecentProblem);
indexManager.renameIndexes(newCfName);
}
public long getBloomFilterFalsePositives()
{
return data.getBloomFilterFalsePositives();

View File

@ -123,14 +123,7 @@ public abstract class SecondaryIndex
* @param columnName the indexed column to remove
*/
public abstract void removeIndex(ByteBuffer columnName) throws IOException;
/**
* Renames the underlying index files to reflect the new CF name
* @param newCfName new column family name.
* @throws IOException on any I/O error.
*/
public abstract void renameIndex(String newCfName) throws IOException;
/**
* Remove the index and unregisters this index's mbean if one exists
*/

View File

@ -247,16 +247,6 @@ public class SecondaryIndexManager
entry.getValue().invalidate();
}
/**
* Rename all underlying index files
* @param newCfName the new index Name
*/
public void renameIndexes(String newCfName) throws IOException
{
for (Map.Entry<ByteBuffer, SecondaryIndex> entry : indexesByColumn.entrySet())
entry.getValue().renameIndex(newCfName);
}
/**
* Flush all indexes to disk
* @throws ExecutionException

View File

@ -148,11 +148,6 @@ public class KeysIndex extends PerColumnSecondaryIndex
return indexCfs.columnFamily;
}
public void renameIndex(String newCfName) throws IOException
{
indexCfs.renameSSTables(indexCfs.columnFamily.replace(baseCfs.columnFamily, newCfName));
}
public void validateOptions() throws ConfigurationException
{
// no options used