Search in sources :

Example 11 with CellName

use of org.apache.cassandra.db.composites.CellName in project janusgraph by JanusGraph.

the class CassandraEmbeddedStoreManager method retryDummyRead.

private void retryDummyRead(String ks, String cf) throws PermanentBackendException {
    final long limit = System.currentTimeMillis() + (60L * 1000L);
    while (System.currentTimeMillis() < limit) {
        try {
            // This is a singleton set.  We need to define a comparator because SimpleDenseCellName is not
            // comparable, but the comparator that we pass into the TreeSet constructor does not have to be useful
            final SortedSet<CellName> names = new TreeSet<>((o1, o2) -> 0);
            names.add(CellNames.simpleDense(ByteBufferUtil.zeroByteBuffer(1)));
            NamesQueryFilter nqf = new NamesQueryFilter(names);
            final SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(ks, ByteBufferUtil.zeroByteBuffer(1), cf, 1L, nqf);
            StorageProxy.read(ImmutableList.of(cmd), ConsistencyLevel.QUORUM);
            log.info("Read on CF {} in KS {} succeeded", cf, ks);
            return;
        } catch (Throwable t) {
            log.warn("Failed to read CF {} in KS {} following creation", cf, ks, t);
        }
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            throw new PermanentBackendException(e);
        }
    }
    throw new PermanentBackendException("Timed out while attempting to read CF " + cf + " in KS " + ks + " following creation");
}
Also used : SliceByNamesReadCommand(org.apache.cassandra.db.SliceByNamesReadCommand) CellName(org.apache.cassandra.db.composites.CellName) NamesQueryFilter(org.apache.cassandra.db.filter.NamesQueryFilter)

Aggregations

CellName (org.apache.cassandra.db.composites.CellName)11 IndexEntryCollector (com.tuplejump.stargate.lucene.IndexEntryCollector)3 ArrayList (java.util.ArrayList)3 ByteBuffer (java.nio.ByteBuffer)2 ColumnDefinition (org.apache.cassandra.config.ColumnDefinition)2 ColumnIdentifier (org.apache.cassandra.cql3.ColumnIdentifier)2 SliceByNamesReadCommand (org.apache.cassandra.db.SliceByNamesReadCommand)2 Composite (org.apache.cassandra.db.composites.Composite)2 ColumnSlice (org.apache.cassandra.db.filter.ColumnSlice)2 NamesQueryFilter (org.apache.cassandra.db.filter.NamesQueryFilter)2 IndexEntry (com.tuplejump.stargate.lucene.IndexEntryCollector.IndexEntry)1 ColumnFamily (org.apache.cassandra.db.ColumnFamily)1 DecoratedKey (org.apache.cassandra.db.DecoratedKey)1 Row (org.apache.cassandra.db.Row)1 CellNameType (org.apache.cassandra.db.composites.CellNameType)1 QueryFilter (org.apache.cassandra.db.filter.QueryFilter)1 SliceQueryFilter (org.apache.cassandra.db.filter.SliceQueryFilter)1 Field (org.apache.lucene.document.Field)1 FieldType (org.apache.lucene.document.FieldType)1