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");
}
Aggregations