use of org.apache.cassandra.config.ColumnDefinition in project eiger by wlloyd.
the class SecondaryIndex method buildIndexBlocking.
/**
* Builds the index using the data in the underlying CFS
* Blocks till it's complete
*/
protected void buildIndexBlocking() throws IOException {
logger.info(String.format("Submitting index build of %s for data in %s", getIndexName(), StringUtils.join(baseCfs.getSSTables(), ", ")));
SortedSet<ByteBuffer> columnNames = new TreeSet<ByteBuffer>();
for (ColumnDefinition cdef : columnDefs) columnNames.add(cdef.name);
Collection<SSTableReader> sstables = baseCfs.markCurrentSSTablesReferenced();
SecondaryIndexBuilder builder = new SecondaryIndexBuilder(baseCfs, columnNames, new ReducingKeyIterator(sstables));
Future<?> future = CompactionManager.instance.submitIndexBuild(builder);
try {
future.get();
forceBlockingFlush();
// Mark all indexed columns as built
if (this instanceof PerRowSecondaryIndex) {
for (ByteBuffer columnName : columnNames) SystemTable.setIndexBuilt(baseCfs.table.name, getIndexName() + ByteBufferUtil.string(columnName));
} else {
SystemTable.setIndexBuilt(baseCfs.table.name, getIndexName());
}
} catch (InterruptedException e) {
throw new AssertionError(e);
} catch (ExecutionException e) {
throw new IOException(e);
} finally {
SSTableReader.releaseReferences(sstables);
}
logger.info("Index build of " + getIndexName() + " complete");
}
use of org.apache.cassandra.config.ColumnDefinition in project eiger by wlloyd.
the class KeysIndex method init.
public void init() {
assert baseCfs != null && columnDefs != null;
ColumnDefinition columnDef = columnDefs.iterator().next();
CFMetaData indexedCfMetadata = CFMetaData.newIndexMetadata(baseCfs.metadata, columnDef, indexComparator());
indexCfs = ColumnFamilyStore.createColumnFamilyStore(baseCfs.table, indexedCfMetadata.cfName, new LocalPartitioner(columnDef.getValidator()), indexedCfMetadata);
}
Aggregations