Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.Table


@Test(groups={"serial"})
public class ServerTest {
    @BeforeMethod
    public void cleanup()
    {
        Table table = Table.open("Table1");
        for (String cfName : table.getColumnFamilies())
        {
            ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
            try
            {
                cfs.reset();
            }
            catch (Exception e)
View Full Code Here


{
    private static EndPoint to_ = new EndPoint("tdsearch001.sf2p.facebook.com", 7000);
   
    private static void doWrite() throws Throwable
    {
        Table table = Table.open("Mailbox")
        Random random = new Random();
        int totalUsed = 0;
        int[] used = new int[16*1024];
        byte[] bytes = new byte[4*1024];
        for (int i = 0; i < 1; ++i)
View Full Code Here

        System.out.println("Write done");
    }
   
    private static void doRead() throws Throwable
    {
        Table table = Table.open("Mailbox");
        String key = "511055962";
               
        /*
        List<String> list = new ArrayList<String>();
        list.add("SuperColumn-0");
        Row row = table.getRow(key, "MailboxMailList0", list);
        System.out.println(row);
        */
       
        List<String> list = new ArrayList<String>();
        list.add("SuperColumn-0");
        list.add("SuperColumn-189");
        list.add("SuperColumn-23");
        Row row = table.getRow("0", "MailboxMailData0", list);
        try
        {
            ColumnFamily cf = row.getColumnFamily("MailboxMailData0");
            Collection<IColumn> columns = cf.getAllColumns();           
            for ( IColumn column : columns )
View Full Code Here

    public void doGC()
    {
        List<String> tables = DatabaseDescriptor.getTables();
        for ( String tName : tables )
        {
            Table table = Table.open(tName);
            table.doGC();
        }
    }
View Full Code Here

        String[] values = RowMutation.getColumnAndColumnFamily(command.columnFamilyColumn);
        if( values.length < 1 )
        {
            throw new CassandraException("Empty column Family is invalid.");
        }
        Table table = Table.open(command.table);
        if (!table.getColumnFamilies().contains(values[0]))
        {
            throw new CassandraException("Column Family " + values[0] + " is invalid.");
        }

        Row row = StorageProxy.readProtocol(command, StorageService.ConsistencyLevel.WEAK);
View Full Code Here

     * is unclear we want to mix those latencies with read latencies, so this
     * may be a bit involved.
     */
    private static InetAddress findSuitableEndpoint(String tableName, ByteBuffer key, String localDataCenter, ConsistencyLevel cl) throws UnavailableException
    {
        Table table = Table.open(tableName);
        IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
        List<InetAddress> endpoints = StorageService.instance.getLiveNaturalEndpoints(table, key);
        if (endpoints.isEmpty())
            // TODO have a way to compute the consistency level
            throw new UnavailableException(cl, cl.blockFor(table), 0);
View Full Code Here

            // send out read requests
            for (int i = 0; i < commands.size(); i++)
            {
                ReadCommand command = commands.get(i);
                Table table = Table.open(command.getKeyspace());
                assert !command.isDigestQuery();

                List<InetAddress> endpoints = getLiveSortedEndpoints(table, command.key);
                CFMetaData cfm = Schema.instance.getCFMetaData(command.getKeyspace(), command.getColumnFamilyName());
View Full Code Here

    throws UnavailableException, ReadTimeoutException
    {
        Tracing.trace("Determining replicas to query");
        long startTime = System.nanoTime();

        Table table = Table.open(command.keyspace);
        List<Row> rows;
        // now scan until we have enough results
        try
        {
            IDiskAtomFilter commandPredicate = command.predicate;
View Full Code Here

            this.handler = handler;
        }

        protected void runMayThrow()
        {
            Table table = Table.open(command.table);
            Row r = command.getRow(table);
            ReadResponse result = ReadVerbHandler.getResponse(command, r);
            MessagingService.instance().addLatency(FBUtilities.getBroadcastAddress(), System.currentTimeMillis() - start);
            handler.response(result);
        }
View Full Code Here

    public double getLoad()
    {
        double bytes = 0;
        for (String tableName : Schema.instance.getTables())
        {
            Table table = Table.open(tableName);
            for (ColumnFamilyStore cfs : table.getColumnFamilyStores())
                bytes += cfs.getLiveDiskSpaceUsed();
        }
        return bytes;
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.Table

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.