* @param columnFamily
* @throws IOException
*/
public static void snapshotWithoutCFS(String keyspace, String columnFamily) throws IOException
{
Directories directories = Directories.create(keyspace, columnFamily);
String snapshotName = "pre-sstablemetamigration";
logger.info("Snapshotting {}, {} to {}", keyspace, columnFamily, snapshotName);
for (Map.Entry<Descriptor, Set<Component>> entry : directories.sstableLister().includeBackups(false).skipTemporary(true).list().entrySet())
{
Descriptor descriptor = entry.getKey();
File snapshotDirectoryPath = Directories.getSnapshotDirectory(descriptor, snapshotName);
for (Component component : entry.getValue())
{
File sourceFile = new File(descriptor.filenameFor(component));
File targetLink = new File(snapshotDirectoryPath, sourceFile.getName());
FileUtils.createHardLink(sourceFile, targetLink);
}
}
File manifestFile = directories.tryGetLeveledManifest();
if (manifestFile != null)
{
File snapshotDirectory = new File(new File(manifestFile.getParentFile(), Directories.SNAPSHOT_SUBDIR), snapshotName);
File target = new File(snapshotDirectory, manifestFile.getName());
FileUtils.createHardLink(manifestFile, target);