Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.Directories$SSTableLister


    public static void migrateManifests(String keyspace, String columnFamily) throws IOException
    {
        logger.info("Migrating manifest for {}/{}", keyspace, columnFamily);

        snapshotWithoutCFS(keyspace, columnFamily);
        Directories directories = Directories.create(keyspace, columnFamily);
        File manifestFile = directories.tryGetLeveledManifest();
        if (manifestFile == null)
            return;

        LegacyLeveledManifest legacyManifest = new LegacyLeveledManifest(manifestFile);
        for (Map.Entry<Descriptor, Set<Component>> entry : directories.sstableLister().includeBackups(false).skipTemporary(true).list().entrySet())
        {
            Descriptor d = entry.getKey();
            Pair<SSTableMetadata, Set<Integer>> oldMetadata = SSTableMetadata.serializer.deserialize(d, false);
            String metadataFilename = d.filenameFor(Component.STATS);
            LeveledManifest.mutateLevel(oldMetadata, d, metadataFilename, legacyManifest.levelOf(d.generation));
View Full Code Here


     * @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);
View Full Code Here

            System.exit(1);
        }

        String keyspace = args[1];
        String columnfamily = args[2];
        Directories directories = Directories.create(keyspace, columnfamily);
        boolean foundSSTable = false;
        for (Map.Entry<Descriptor, Set<Component>> sstable : directories.sstableLister().list().entrySet())
        {
            if (sstable.getValue().contains(Component.STATS))
            {
                foundSSTable = true;
                Descriptor descriptor = sstable.getKey();
View Full Code Here

    public static void migrateManifests(String keyspace, String columnFamily) throws IOException
    {
        logger.info("Migrating manifest for {}/{}", keyspace, columnFamily);

        snapshotWithoutCFS(keyspace, columnFamily);
        Directories directories = Directories.create(keyspace, columnFamily);
        File manifestFile = directories.tryGetLeveledManifest();
        if (manifestFile == null)
            return;

        LegacyLeveledManifest legacyManifest = new LegacyLeveledManifest(manifestFile);
        for (Map.Entry<Descriptor, Set<Component>> entry : directories.sstableLister().includeBackups(false).skipTemporary(true).list().entrySet())
        {
            Descriptor d = entry.getKey();
            Pair<SSTableMetadata, Set<Integer>> oldMetadata = SSTableMetadata.serializer.deserialize(d, false);
            String metadataFilename = d.filenameFor(Component.STATS);
            LeveledManifest.mutateLevel(oldMetadata, d, metadataFilename, legacyManifest.levelOf(d.generation));
View Full Code Here

     * @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);
            if (!snapshotDirectory.exists())
                snapshotDirectory.mkdirs();
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.Directories$SSTableLister

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.