public KSMetaData validate() throws ConfigurationException { if (!CFMetaData.isNameValid(name)) throw new ConfigurationException( String.format( "Invalid keyspace name: shouldn't be empty nor more than %s characters long (got \"%s\")", Schema.NAME_LENGTH, name)); // Attempt to instantiate the ARS, which will throw a ConfigException if the strategy_options // aren't fully formed TokenMetadata tmd = StorageService.instance.getTokenMetadata(); IEndpointSnitch eps = DatabaseDescriptor.getEndpointSnitch(); AbstractReplicationStrategy.createReplicationStrategy( name, strategyClass, tmd, eps, strategyOptions); for (CFMetaData cfm : cfMetaData.values()) cfm.validate(); return this; }
public static void main(String args[]) { Config.setClientMode(true); 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 } catch (Exception e) { System.err.println("Streaming to the following hosts failed:"); System.err.println(loader.getFailedHosts()); System.err.println(e); if (options.debug) e.printStackTrace(System.err); System.exit(1); } }
protected void tearDown() { DatabaseDescriptor.setPartitioner(oldPartitioner); }
protected void setUp() { oldPartitioner = DatabaseDescriptor.getPartitioner(); DatabaseDescriptor.setPartitioner(new LengthPartitioner()); }