Package org.apache.cassandra.utils

Examples of org.apache.cassandra.utils.OutputHandler$SystemOutput


    private static final String THROTTLE_MBITS = "throttle";

    public static void main(String args[])
    {
        LoaderOptions options = LoaderOptions.parseArgs(args);
        OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
        SSTableLoader loader = new SSTableLoader(options.directory, new ExternalClient(options.hosts, options.rpcPort, options.user, options.passwd), handler);
        DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle);
        StreamResultFuture future = loader.stream(options.ignores);
        future.addEventListener(new ProgressIndicator());
        try
View Full Code Here


                                                                 options.cf));

            Keyspace keyspace = Keyspace.openWithoutSSTables(options.keyspace);
            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(options.cf);

            OutputHandler handler = new OutputHandler.SystemOutput(false, options.debug);
            Directories.SSTableLister lister = cfs.directories.sstableLister();
            if (options.snapshot != null)
                lister.onlyBackups(true).snapshots(options.snapshot);
            else
                lister.includeBackups(false);

            Collection<SSTableReader> readers = new ArrayList<SSTableReader>();

            // Upgrade sstables
            for (Map.Entry<Descriptor, Set<Component>> entry : lister.list().entrySet())
            {
                Set<Component> components = entry.getValue();
                if (!components.contains(Component.DATA) || !components.contains(Component.PRIMARY_INDEX))
                    continue;

                try
                {
                    SSTableReader sstable = SSTableReader.openNoValidation(entry.getKey(), components, cfs.metadata);
                    if (sstable.descriptor.version.equals(Descriptor.Version.CURRENT))
                        continue;
                    readers.add(sstable);
                }
                catch (Exception e)
                {
                    System.err.println(String.format("Error Loading %s: %s", entry.getKey(), e.getMessage()));
                    if (options.debug)
                        e.printStackTrace(System.err);

                    continue;
                }
            }

            int numSSTables = readers.size();
            handler.output("Found " + numSSTables + " sstables that need upgrading.");

            for (SSTableReader sstable : readers)
            {
                try
                {
View Full Code Here

            // Do not load sstables since they might be broken
            Keyspace keyspace = Keyspace.openWithoutSSTables(options.keyspaceName);
            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(options.cfName);
            String snapshotName = "pre-scrub-" + System.currentTimeMillis();

            OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
            Directories.SSTableLister lister = cfs.directories.sstableLister().skipTemporary(true);

            List<SSTableReader> sstables = new ArrayList<SSTableReader>();

            // Scrub sstables
View Full Code Here

    public static void main(String args[]) throws IOException
    {
        Options options = Options.parseArgs(args);
        try
        {
            OutputHandler handler = new OutputHandler.SystemOutput(false, options.debug);
            // Migrate sstables from pre-#2749 to the correct location
            if (Directories.sstablesNeedsMigration())
            {
                if (!options.migrate)
                {
                    System.err.println("Detected a pre-1.1 data directory layout.  For this tool to work, a migration " +
                                       "must be performed to the 1.1+ format for directories and filenames.  Re-run " +
                                       TOOL_NAME + " with the --" + MIGRATE_OPTION + " option to automatically " +
                                       "migrate *all* keyspaces and column families to the new layout.");
                    System.exit(1);
                }
                handler.output("Detected a pre-1.1 data directory layout. All keyspace and column family directories " +
                               "will be migrated to the 1.1+ format.");
                Directories.migrateSSTables();
            }

            // load keyspace descriptions.
            DatabaseDescriptor.loadSchemas();

            if (Schema.instance.getCFMetaData(options.keyspace, options.cf) == null)
                throw new IllegalArgumentException(String.format("Unknown keyspace/columnFamily %s.%s",
                                                                 options.keyspace,
                                                                 options.cf));

            Table table = Table.openWithoutSSTables(options.keyspace);
            ColumnFamilyStore cfs = table.getColumnFamilyStore(options.cf);

            Directories.SSTableLister lister = cfs.directories.sstableLister();
            if (options.snapshot != null)
                lister.onlyBackups(true).snapshots(options.snapshot);
            else
                lister.includeBackups(false);

            Collection<SSTableReader> readers = new ArrayList<SSTableReader>();

            // Upgrade sstables
            for (Map.Entry<Descriptor, Set<Component>> entry : lister.list().entrySet())
            {
                Set<Component> components = entry.getValue();
                if (!components.contains(Component.DATA) || !components.contains(Component.PRIMARY_INDEX))
                    continue;

                try
                {
                    SSTableReader sstable = SSTableReader.openNoValidation(entry.getKey(), components, cfs.metadata);
                    if (sstable.descriptor.version.equals(Descriptor.Version.CURRENT))
                        continue;
                    readers.add(sstable);
                }
                catch (Exception e)
                {
                    System.err.println(String.format("Error Loading %s: %s", entry.getKey(), e.getMessage()));
                    if (options.debug)
                        e.printStackTrace(System.err);

                    continue;
                }
            }

            int numSSTables = readers.size();
            handler.output("Found " + numSSTables + " sstables that need upgrading.");

            for (SSTableReader sstable : readers)
            {
                try
                {
View Full Code Here

    public static void main(String args[]) throws IOException
    {
        LoaderOptions options = LoaderOptions.parseArgs(args);
        try
        {
            OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
            SSTableLoader loader = new SSTableLoader(options.directory, new ExternalClient(handler, options.hosts, options.rpcPort, options.user, options.passwd), handler);
            DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle);
            SSTableLoader.LoaderFuture future = loader.stream(options.ignores);

            if (options.noProgress)
View Full Code Here

    public static void main(String args[]) throws IOException
    {
        Options options = Options.parseArgs(args);
        try
        {
            OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);

            // Migrate sstables from pre-#2749 to the correct location
            if (Directories.sstablesNeedsMigration())
            {
                if (!options.migrate)
                {
                    System.err.println("Detected a pre-1.1 data directory layout.  For this tool to work, a migration " +
                                       "must be performed to the 1.1+ format for directories and filenames.  Re-run " +
                                       TOOL_NAME + " with the --" + MIGRATE_OPTION + " option to automatically " +
                                       "migrate *all* keyspaces and column families to the new layout.");
                    System.exit(1);
                }
                handler.output("Detected a pre-1.1 data directory layout. All keyspace and column family directories " +
                               "will be migrated to the 1.1+ format.");
                Directories.migrateSSTables();
            }

            // load keyspace descriptions.
View Full Code Here

            // Do not load sstables since they might be broken
            Keyspace keyspace = Keyspace.openWithoutSSTables(options.keyspaceName);
            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(options.cfName);
            String snapshotName = "pre-scrub-" + System.currentTimeMillis();

            OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
            Directories.SSTableLister lister = cfs.directories.sstableLister().skipTemporary(true);

            List<SSTableReader> sstables = new ArrayList<SSTableReader>();

            // Scrub sstables
View Full Code Here

    private static final String CONFIG_PATH = "conf-path";

    public static void main(String args[])
    {
        LoaderOptions options = LoaderOptions.parseArgs(args);
        OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
        SSTableLoader loader = new SSTableLoader(options.directory, new ExternalClient(options.hosts,
                                                                                       options.rpcPort,
                                                                                       options.user,
                                                                                       options.passwd,
                                                                                       options.transportFactory,
                                                                                       options.storagePort,
                                                                                       options.sslStoragePort,
                                                                                       options.serverEncOptions), handler);
        DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle);
        StreamResultFuture future = null;
        try
        {
            if (options.noProgress)
                future = loader.stream(options.ignores);
            else
                future = loader.stream(options.ignores, new ProgressIndicator());
        }
        catch (Exception e)
        {
            System.err.println(e.getMessage());
            if (e.getCause() != null)
                System.err.println(e.getCause());
            if (options.debug)
                e.printStackTrace(System.err);
            else
                System.err.println("Run with --debug to get full stack trace or --help to get help.");
            System.exit(1);
        }

        handler.output(String.format("Streaming session ID: %s", future.planId));

        try
        {
            future.get();
            System.exit(0); // We need that to stop non daemonized threads
View Full Code Here

            // Do not load sstables since they might be broken
            Keyspace keyspace = Keyspace.openWithoutSSTables(options.keyspaceName);
            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(options.cfName);
            String snapshotName = "pre-scrub-" + System.currentTimeMillis();

            OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
            Directories.SSTableLister lister = cfs.directories.sstableLister().skipTemporary(true);

            List<SSTableReader> sstables = new ArrayList<SSTableReader>();

            // Scrub sstables
View Full Code Here

                                                                 options.cf));

            Keyspace keyspace = Keyspace.openWithoutSSTables(options.keyspace);
            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(options.cf);

            OutputHandler handler = new OutputHandler.SystemOutput(false, options.debug);
            Directories.SSTableLister lister = cfs.directories.sstableLister();
            if (options.snapshot != null)
                lister.onlyBackups(true).snapshots(options.snapshot);
            else
                lister.includeBackups(false);

            Collection<SSTableReader> readers = new ArrayList<SSTableReader>();

            // Upgrade sstables
            for (Map.Entry<Descriptor, Set<Component>> entry : lister.list().entrySet())
            {
                Set<Component> components = entry.getValue();
                if (!components.contains(Component.DATA) || !components.contains(Component.PRIMARY_INDEX))
                    continue;

                try
                {
                    SSTableReader sstable = SSTableReader.openNoValidation(entry.getKey(), components, cfs.metadata);
                    if (sstable.descriptor.version.equals(Descriptor.Version.CURRENT))
                        continue;
                    readers.add(sstable);
                }
                catch (Exception e)
                {
                    System.err.println(String.format("Error Loading %s: %s", entry.getKey(), e.getMessage()));
                    if (options.debug)
                        e.printStackTrace(System.err);

                    continue;
                }
            }

            int numSSTables = readers.size();
            handler.output("Found " + numSSTables + " sstables that need upgrading.");

            for (SSTableReader sstable : readers)
            {
                try
                {
View Full Code Here

TOP

Related Classes of org.apache.cassandra.utils.OutputHandler$SystemOutput

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.