/** * Returns the parent of the specified {@link ColumnFamilyStore}. * * @param cfs the <code>ColumnFamilyStore</code> * @return the parent of the specified <code>ColumnFamilyStore</code> */ public static ColumnFamilyStore getParentCfs(ColumnFamilyStore cfs) { String parentCfs = getParentCfsName(cfs.name); return cfs.keyspace.getColumnFamilyStore(parentCfs); }
/** * Returns the parent of the specified {@link ColumnFamilyStore}. * * @param cfs the <code>ColumnFamilyStore</code> * @return the parent of the specified <code>ColumnFamilyStore</code> */ public static ColumnFamilyStore getParentCfs(ColumnFamilyStore cfs) { String parentCfs = getParentCfsName(cfs.name); return cfs.keyspace.getColumnFamilyStore(parentCfs); }
public ColumnFamilyStore getColumnFamilyStoreInstance(UUID cfId) { Pair<String, String> pair = cfIdMap.inverse().get(cfId); if (pair == null) return null; Keyspace instance = getKeyspaceInstance(pair.left); if (instance == null) return null; return instance.getColumnFamilyStore(cfId); }
public ColumnFamilyStore getColumnFamilyStoreInstance(UUID cfId) { Pair<String, String> pair = cfIdMap.inverse().get(cfId); if (pair == null) return null; Keyspace instance = getKeyspaceInstance(pair.left); if (instance == null) return null; return instance.getColumnFamilyStore(cfId); }
public static void rebuildSecondaryIndex(String ksName, String cfName, String... idxNames) { ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(cfName); Set<String> indexes = new HashSet<String>(Arrays.asList(idxNames)); Iterable<SSTableReader> sstables = cfs.getSSTables(SSTableSet.CANONICAL); try (Refs<SSTableReader> refs = Refs.ref(sstables)) { logger.info("User Requested secondary index re-build for {}/{} indexes: {}", ksName, cfName, Joiner.on(',').join(idxNames)); cfs.indexManager.rebuildIndexesBlocking(refs, indexes); } }
/** * See #{@code StorageService.loadNewSSTables(String, String)} for more info * * @param ksName The keyspace name * @param cfName The columnFamily name */ public static void loadNewSSTables(String ksName, String cfName) { /** ks/cf existence checks will be done by open and getCFS methods for us */ Keyspace keyspace = Keyspace.open(ksName); keyspace.getColumnFamilyStore(cfName).loadNewSSTables(); }
public static void resetAvailableRanges() { ColumnFamilyStore availableRanges = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(AVAILABLE_RANGES); availableRanges.truncateBlocking(); }
public static void resetPreparedStatements() { ColumnFamilyStore availableRanges = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(PREPARED_STATEMENTS); availableRanges.truncateBlocking(); }
public LegacyHintsMigrator(File hintsDirectory, long maxHintsFileSize) { this.hintsDirectory = hintsDirectory; this.maxHintsFileSize = maxHintsFileSize; legacyHintsTable = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(SystemKeyspace.LEGACY_HINTS); pageSize = calculatePageSize(legacyHintsTable); }
/** * See #{@code StorageService.loadNewSSTables(String, String)} for more info * * @param ksName The keyspace name * @param cfName The columnFamily name */ public static synchronized void loadNewSSTables(String ksName, String cfName) { /** ks/cf existence checks will be done by open and getCFS methods for us */ Keyspace keyspace = Keyspace.open(ksName); keyspace.getColumnFamilyStore(cfName).loadNewSSTables(); }
public LegacyHintsMigrator(File hintsDirectory, long maxHintsFileSize) { this.hintsDirectory = hintsDirectory; this.maxHintsFileSize = maxHintsFileSize; legacyHintsTable = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(SystemKeyspace.LEGACY_HINTS); pageSize = calculatePageSize(legacyHintsTable); }
public ColumnFamilyStore getColumnFamilyStore(String cfName) { UUID id = Schema.instance.getId(getName(), cfName); if (id == null) throw new IllegalArgumentException(String.format("Unknown keyspace/cf pair (%s.%s)", getName(), cfName)); return getColumnFamilyStore(id); }
public static void resetPreparedStatements() { ColumnFamilyStore availableRanges = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(PREPARED_STATEMENTS); availableRanges.truncateBlocking(); }
public static void rebuildSecondaryIndex(String ksName, String cfName, String... idxNames) { ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(cfName); Set<String> indexes = new HashSet<String>(Arrays.asList(idxNames)); Iterable<SSTableReader> sstables = cfs.getSSTables(SSTableSet.CANONICAL); try (Refs<SSTableReader> refs = Refs.ref(sstables)) { logger.info("User Requested secondary index re-build for {}/{} indexes: {}", ksName, cfName, Joiner.on(',').join(idxNames)); cfs.indexManager.rebuildIndexesBlocking(refs, indexes); } }
/** * Allow to post-process the result of the query after it has been reconciled on the coordinator * but before it is passed to the CQL layer to return the ResultSet. * * See CASSANDRA-8717 for why this exists. */ public PartitionIterator postReconciliationProcessing(PartitionIterator result) { ColumnFamilyStore cfs = Keyspace.open(metadata().ksName).getColumnFamilyStore(metadata().cfName); Index index = getIndex(cfs); return index == null ? result : index.postProcessorFor(this).apply(result, this); }
/** * May be used by custom QueryHandler implementations */ public RowFilter getRowFilter(QueryOptions options) throws InvalidRequestException { ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(columnFamily()); SecondaryIndexManager secondaryIndexManager = cfs.indexManager; RowFilter filter = restrictions.getRowFilter(secondaryIndexManager, options); return filter; }
public static void forceBlockingFlush(String table) { if (!DatabaseDescriptor.isUnsafeSystem()) FBUtilities.waitOnFuture(Keyspace.open(SchemaConstants.DISTRIBUTED_KEYSPACE_NAME).getColumnFamilyStore(table).forceFlush()); }
public static void forceBlockingFlush(String cfname) { if (!DatabaseDescriptor.isUnsafeSystem()) FBUtilities.waitOnFuture(Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME).getColumnFamilyStore(cfname).forceFlush()); }
public static void forceBlockingFlush(String table) { if (!DatabaseDescriptor.isUnsafeSystem()) FBUtilities.waitOnFuture(Keyspace.open(SchemaConstants.DISTRIBUTED_KEYSPACE_NAME).getColumnFamilyStore(table).forceFlush()); }
public void updateTable(CFMetaData table) { CFMetaData current = getCFMetaData(table.ksName, table.cfName); assert current != null; boolean changeAffectsStatements = current.apply(table); Keyspace keyspace = Keyspace.open(current.ksName); keyspace.getColumnFamilyStore(current.cfName).reload(); MigrationManager.instance.notifyUpdateColumnFamily(current, changeAffectsStatements); }