Package org.apache.cassandra.db.migration

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


    {
        // create a keyspace to serve as existing.
        CFMetaData cf = addTestCF("UpdatedKeyspace", "AddedStandard1", "A new cf for a new ks");
        KSMetaData oldKs = new KSMetaData(cf.tableName, SimpleStrategy.class, null, 5, cf);
       
        new AddKeyspace(oldKs).apply();
       
        assert DatabaseDescriptor.getTableDefinition(cf.tableName) != null;
        assert DatabaseDescriptor.getTableDefinition(cf.tableName) == 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 = new KSMetaData(cf.tableName, SimpleStrategy.class, null, 1, cf);
        new AddKeyspace(ksm).apply();
       
        assert DatabaseDescriptor.getTableDefinition(cf.tableName) != null;
        assert DatabaseDescriptor.getTableDefinition(cf.tableName) == ksm;
        assert DatabaseDescriptor.getCFMetaData(cf.tableName, cf.cfName) != null;
       
View Full Code Here

                    ksDef.name.toString(),
                    FBUtilities.<AbstractReplicationStrategy>classForName(ksDef.strategy_class.toString(), "keyspace replication strategy"),
                    strategyOptions,
                    ksDef.replication_factor,
                    cfDefs.toArray(new CFMetaData[cfDefs.size()]));
            applyMigrationOnStage(new AddKeyspace(ksmeta));
            return DatabaseDescriptor.getDefsVersion().toString();
           
        }
        catch (ConfigurationException e)
        {
View Full Code Here

            KSMetaData ksm = new KSMetaData(ks_def.name,
                                            FBUtilities.<AbstractReplicationStrategy>classForName(ks_def.strategy_class, "keyspace replication strategy"),
                                            ks_def.strategy_options,
                                            ks_def.replication_factor,
                                            cfDefs.toArray(new CFMetaData[cfDefs.size()]));
            applyMigrationOnStage(new AddKeyspace(ksm));
            return DatabaseDescriptor.getDefsVersion().toString();
        }
        catch (ConfigurationException e)
        {
            InvalidRequestException ex = new InvalidRequestException(e.getMessage());
View Full Code Here

                    throw new ConfigurationException("Cannot import schema when one already exists");
            
                Migration migration = null;
                for (KSMetaData table : tables)
                {
                    migration = new AddKeyspace(table);
                    migration.apply();
                }
                return migration;
            }
        };
View Full Code Here

        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 Schema.instance.getTableDefinition(newCf.ksName) != null;
        assert Schema.instance.getTableDefinition(newCf.ksName) == newKs;

        // test reads and writes.
View Full Code Here

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

        new AddKeyspace(newKs).apply();
        assert Schema.instance.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 Schema.instance.getTableDefinition(cf.ksName) != null;
        assert Schema.instance.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 Schema.instance.getTableDefinition(cf.ksName) != null;
        assert Schema.instance.getTableDefinition(cf.ksName) == ksm;
        assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName) != null;
       
View Full Code Here

        CleanupHelper.cleanupAndLeaveDirs();
        DatabaseDescriptor.loadSchemas();
        assert Schema.instance.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 Schema.instance.getTableDefinition("ks0") != null;
        assert Schema.instance.getTableDefinition("ks1") != null;

        Schema.instance.clearTableDefinition(Schema.instance.getTableDefinition("ks0"), new UUID(4096, 0));
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.