Package org.apache.cassandra.config

Examples of org.apache.cassandra.config.KSMetaData


        Schema.instance.clearTableDefinition(ksm);
    }

    private static void dropColumnFamily(String ksName, String cfName, long timestamp, boolean withSchemaRecord) throws IOException
    {
        KSMetaData ksm = Schema.instance.getTableDefinition(ksName);
        ColumnFamilyStore cfs = Table.open(ksName).getColumnFamilyStore(cfName);

        // reinitialize the table.
        CFMetaData cfm = ksm.cfMetaData().get(cfName);

        Schema.instance.purge(cfm);
        Schema.instance.setTableDefinition(makeNewKeyspaceDefinition(ksm, cfm));

        if (withSchemaRecord)
View Full Code Here


   
    public DropColumnFamily(String ksName, String cfName) throws ConfigurationException
    {
        super(System.nanoTime());

        KSMetaData ksm = Schema.instance.getTableDefinition(ksName);
        if (ksm == null)
            throw new ConfigurationException("Can't drop ColumnFamily: No such keyspace '" + ksName + "'.");
        else if (!ksm.cfMetaData().containsKey(cfName))
            throw new ConfigurationException(String.format("Can't drop ColumnFamily (ks=%s, cf=%s) : Not defined in that keyspace.", ksName, cfName));

        this.ksName = ksName;
        this.cfName = cfName;
    }
View Full Code Here

   
    public DropKeyspace(String name) throws ConfigurationException
    {
        super(System.nanoTime());

        KSMetaData ksm = Schema.instance.getTableDefinition(name);
        if (ksm == null)
            throw new ConfigurationException("Can't drop keyspace '" + name + "' because it does not exist.");

        this.name = name;
    }
View Full Code Here

   
    public AddColumnFamily(CFMetaData cfm) throws ConfigurationException
    {
        super(System.nanoTime());

        KSMetaData ksm = Schema.instance.getTableDefinition(cfm.ksName);

        if (ksm == null)
            throw new ConfigurationException(String.format("Can't add ColumnFamily '%s' to Keyspace '%s': Keyspace does not exist.", cfm.cfName, cfm.ksName));
        else if (ksm.cfMetaData().containsKey(cfm.cfName))
            throw new ConfigurationException(String.format("Can't add ColumnFamily '%s' to Keyspace '%s': Already exists.", cfm.cfName, cfm.ksName));
        else if (!Migration.isLegalName(cfm.cfName))
            throw new ConfigurationException("Can't add ColumnFamily '%s' to Keyspace '%s': Invalid ColumnFamily name.");

        this.cfm = cfm;
View Full Code Here

                strategy.configOptions);
    }

    private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws ConfigurationException
    {
        KSMetaData ksmd = Schema.instance.getKSMetaData(table);
        return AbstractReplicationStrategy.createReplicationStrategy(
                table,
                ksmd.strategyClass,
                tmd,
                new SimpleSnitch(),
View Full Code Here

        return addrs;
    }

    private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws ConfigurationException
    {
        KSMetaData ksmd = Schema.instance.getKSMetaData(table);
        return AbstractReplicationStrategy.createReplicationStrategy(
                table,
                ksmd.strategyClass,
                tmd,
                new SimpleSnitch(),
View Full Code Here

    }

    // Copy-pasta from MoveTest.java
    private AbstractReplicationStrategy getStrategy(String table, TokenMetadata tmd) throws ConfigurationException
    {
        KSMetaData ksmd = Schema.instance.getKSMetaData(table);
        return AbstractReplicationStrategy.createReplicationStrategy(
                table,
                ksmd.strategyClass,
                tmd,
                new SimpleSnitch(),
View Full Code Here

        }
    }

    public KsDef describe_keyspace(String table) throws NotFoundException, InvalidRequestException
    {
        KSMetaData ksm = Schema.instance.getTableDefinition(table);
        if (ksm == null)
            throw new NotFoundException();

        return ksm.toThrift();
    }
View Full Code Here

        }

        // add entries to system schema columnfamilies for the hardcoded system definitions
        for (String ksname : Schema.systemKeyspaceNames)
        {
            KSMetaData ksmd = Schema.instance.getKSMetaData(ksname);

            // delete old, possibly obsolete entries in schema columnfamilies
            for (String cfname : Arrays.asList(SystemTable.SCHEMA_KEYSPACES_CF, SystemTable.SCHEMA_COLUMNFAMILIES_CF, SystemTable.SCHEMA_COLUMNS_CF))
            {
                String req = String.format("DELETE FROM system.%s WHERE keyspace_name = '%s'", cfname, ksmd.name);
                processInternal(req);
            }

            // (+1 to timestamp to make sure we don't get shadowed by the tombstones we just added)
            ksmd.toSchema(FBUtilities.timestampMicros() + 1).apply();
        }
    }
View Full Code Here

                StorageProxy.instance.verifyNoHintsInProgress();

                List<Future<?>> flushes = new ArrayList<Future<?>>();
                for (Table table : Table.all())
                {
                    KSMetaData ksm = Schema.instance.getKSMetaData(table.name);
                    if (!ksm.durableWrites)
                    {
                        for (ColumnFamilyStore cfs : table.getColumnFamilyStores())
                            flushes.add(cfs.forceFlush());
                    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.config.KSMetaData

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.