Package org.apache.cassandra.db.migration

Examples of org.apache.cassandra.db.migration.AddKeyspace


        DecoratedKey dk = Util.dk("key0");
        CFMetaData newCf = addTestCF("NewKeyspace1", "AddedStandard1", "A new cf for a new ks");

        KSMetaData newKs = KSMetaData.testMetadata(newCf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5), newCf);
       
        new AddKeyspace(newKs).apply();
       
        assert DatabaseDescriptor.getTableDefinition(newCf.ksName) != null;
        assert DatabaseDescriptor.getTableDefinition(newCf.ksName) == newKs;

        // test reads and writes.
View Full Code Here


    {
        assert DatabaseDescriptor.getTableDefinition("EmptyKeyspace") == null;
       
        KSMetaData newKs = KSMetaData.testMetadata("EmptyKeyspace", SimpleStrategy.class, KSMetaData.optsWithRF(5));

        new AddKeyspace(newKs).apply();
        assert DatabaseDescriptor.getTableDefinition("EmptyKeyspace") != null;

        CFMetaData newCf = addTestCF("EmptyKeyspace", "AddedLater", "A new CF to add to an empty KS");

        //should not exist until apply
View Full Code Here

    {
        // create a keyspace to serve as existing.
        CFMetaData cf = addTestCF("UpdatedKeyspace", "AddedStandard1", "A new cf for a new ks");
        KSMetaData oldKs = KSMetaData.testMetadata(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5), cf);
       
        new AddKeyspace(oldKs).apply();
       
        assert DatabaseDescriptor.getTableDefinition(cf.ksName) != null;
        assert DatabaseDescriptor.getTableDefinition(cf.ksName) == oldKs;
       
        // anything with cf defs should fail.
View Full Code Here

    public void testUpdateColumnFamilyNoIndexes() throws ConfigurationException, IOException, ExecutionException, InterruptedException
    {
        // create a keyspace with a cf to update.
        CFMetaData cf = addTestCF("UpdatedCfKs", "Standard1added", "A new cf that will be updated");
        KSMetaData ksm = KSMetaData.testMetadata(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(1), cf);
        new AddKeyspace(ksm).apply();
       
        assert DatabaseDescriptor.getTableDefinition(cf.ksName) != null;
        assert DatabaseDescriptor.getTableDefinition(cf.ksName) == ksm;
        assert DatabaseDescriptor.getCFMetaData(cf.ksName, cf.cfName) != null;
       
View Full Code Here

        CleanupHelper.cleanupAndLeaveDirs();
        DatabaseDescriptor.loadSchemas();
        assert DatabaseDescriptor.getNonSystemTables().size() == 0;
       
        // add a few.
        AddKeyspace ks0 = new AddKeyspace(KSMetaData.testMetadata("ks0", SimpleStrategy.class, KSMetaData.optsWithRF(3)));
        ks0.apply();
        AddKeyspace ks1 = new AddKeyspace(KSMetaData.testMetadata("ks1", SimpleStrategy.class, KSMetaData.optsWithRF(3)));
        ks1.apply();
       
        assert DatabaseDescriptor.getTableDefinition("ks0") != null;
        assert DatabaseDescriptor.getTableDefinition("ks1") != null;
       
        DatabaseDescriptor.clearTableDefinition(DatabaseDescriptor.getTableDefinition("ks0"), new UUID(4096, 0));
View Full Code Here

        CleanupHelper.cleanupAndLeaveDirs();
        DatabaseDescriptor.loadSchemas();
        assert DatabaseDescriptor.getNonSystemTables().size() == 0;
       
        // add a few.
        AddKeyspace ks0 = new AddKeyspace(new KSMetaData("ks0", SimpleStrategy.class, null, 3));
        ks0.apply();
        AddKeyspace ks1 = new AddKeyspace(new KSMetaData("ks1", SimpleStrategy.class, null, 3));
        ks1.apply();
       
        assert DatabaseDescriptor.getTableDefinition("ks0") != null;
        assert DatabaseDescriptor.getTableDefinition("ks1") != null;
       
        DatabaseDescriptor.clearTableDefinition(DatabaseDescriptor.getTableDefinition("ks0"), new UUID(4096, 0));
View Full Code Here

                                                                       totalNodes, table.replicationFactor));
               
                Migration migration = null;
                for (KSMetaData table : tables)
                {
                    migration = new AddKeyspace(table);
                    migration.apply();
                }
                return migration;
            }
        };
View Full Code Here

                    ks_def.name,
                    (Class<? extends AbstractReplicationStrategy>)Class.forName(ks_def.strategy_class),
                    ks_def.strategy_options,
                    ks_def.replication_factor,
                    cfDefs.toArray(new CFMetaData[cfDefs.size()]));
            applyMigrationOnStage(new AddKeyspace(ksm));
            return DatabaseDescriptor.getDefsVersion().toString();
        }
        catch (ClassNotFoundException e)
        {
            InvalidRequestException ex = new InvalidRequestException(e.getMessage());
View Full Code Here

                    ksDef.name.toString(),
                    (Class<? extends AbstractReplicationStrategy>)Class.forName(ksDef.strategy_class.toString()),
                    strategyOptions,
                    ksDef.replication_factor,
                    cfDefs.toArray(new CFMetaData[cfDefs.size()]));
            applyMigrationOnStage(new AddKeyspace(ksmeta));
            return DatabaseDescriptor.getDefsVersion().toString();
           
        }
        catch (ClassNotFoundException e)
        {
View Full Code Here

                try
                {
                    KSMetaData ksm = new KSMetaData(create.getName(),
                                                    AbstractReplicationStrategy.getClass(create.getStrategyClass()),
                                                    create.getStrategyOptions());
                    applyMigrationOnStage(new AddKeyspace(ksm));
                }
                catch (ConfigurationException e)
                {
                    InvalidRequestException ex = new InvalidRequestException(e.getMessage());
                    ex.initCause(e);
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.migration.AddKeyspace

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.