Package org.apache.cassandra.db
Class Keyspace
java.lang.Object
org.apache.cassandra.db.Keyspace
It represents a Keyspace.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionall()voidvoidvoidIf apply is blocking, apply must not be deferred Otherwise there is a race condition where ALL mutation workers are beeing blocked ending in a complete deadlock of the mutation stage.Future<?>applyFuture(Mutation mutation, boolean writeCommitLog, boolean updateIndexes) Future<?>applyFuture(Mutation mutation, boolean writeCommitLog, boolean updateIndexes, boolean isDroppable, boolean isDeferrable) voidflush(ColumnFamilyStore.FlushReason reason) getAllSSTables(SSTableSet sstableSet) getColumnFamilyStore(String cfName) getIfExists(TableId id) getName()static StringgetTimestampedSnapshotName(String clientSuppliedName) static StringgetTimestampedSnapshotNameWithPrefix(String clientSuppliedName, String prefix) getValidColumnFamilies(boolean allowIndexes, boolean autoAddIndexes, String... cfNames) booleanvoidinitCf(TableMetadataRef metadata, boolean loadSSTables) adds a cf to internal structures, ends up creating disk files).voidinitCfCustom(ColumnFamilyStore newCfs) Registers a custom cf instance with this keyspace.static booleanstatic KeyspacemockKS(KeyspaceMetadata metadata) static Keyspacestatic Keyspaceopen(String keyspaceName, SchemaProvider schema, boolean loadSSTables) static ColumnFamilyStoreopenAndGetStore(TableMetadata table) static ColumnFamilyStoreopenAndGetStore(TableMetadataRef tableRef) static ColumnFamilyStorestatic KeyspaceopenWithoutSSTables(String keyspaceName) static voidremoveUnreadableSSTables(File directory) Removes every SSTable in the directory from the appropriate Tracker's view.static voidvoidsetMetadata(KeyspaceMetadata metadata) voidTake a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestampvoidsnapshot(String snapshotName, String columnFamilyName, boolean skipFlush, DurationSpec.IntSecondsBound ttl, com.google.common.util.concurrent.RateLimiter rateLimiter, Instant creationTime) Take a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestampbooleansnapshotExists(String snapshotName) Check whether snapshots already exists for a given name.system()toString()voidunload(boolean dropData) Unloads all column family stores and releases metrics.static voidNever use it in production code.
-
Field Details
-
metric
-
writeOrder
-
viewManager
-
-
Method Details
-
isInitialized
public static boolean isInitialized() -
setInitialized
public static void setInitialized() -
unsetInitialized
public static void unsetInitialized()Never use it in production code. Useful when creating a fake Schema so that it does not manage Keyspace instances (and CFS) -
open
-
openWithoutSSTables
-
open
-
openAndGetStore
-
openAndGetStore
-
openAndGetStoreIfExists
-
removeUnreadableSSTables
Removes every SSTable in the directory from the appropriate Tracker's view.- Parameters:
directory- the unreadable directory, possibly with SSTables in it, but not necessarily.
-
setMetadata
-
getMetadata
-
getColumnFamilyStores
-
getColumnFamilyStore
-
getColumnFamilyStore
-
getIfExists
-
hasColumnFamilyStore
-
snapshot
public void snapshot(String snapshotName, String columnFamilyName, boolean skipFlush, DurationSpec.IntSecondsBound ttl, com.google.common.util.concurrent.RateLimiter rateLimiter, Instant creationTime) throws IOException Take a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestamp- Parameters:
snapshotName- the tag associated with the name of the snapshot. This value may not be nullcolumnFamilyName- the column family to snapshot or all on nullskipFlush- Skip blocking flush of memtablerateLimiter- Rate limiter for hardlinks-per-second- Throws:
IOException- if the column family doesn't exist
-
snapshot
Take a snapshot of the specific column family, or the entire set of column families if columnFamily is null with a given timestamp- Parameters:
snapshotName- the tag associated with the name of the snapshot. This value may not be nullcolumnFamilyName- the column family to snapshot or all on null- Throws:
IOException- if the column family doesn't exist
-
getTimestampedSnapshotName
- Parameters:
clientSuppliedName- may be null.- Returns:
- the name of the snapshot
-
getTimestampedSnapshotNameWithPrefix
-
snapshotExists
Check whether snapshots already exists for a given name.- Parameters:
snapshotName- the user supplied snapshot name- Returns:
- true if the snapshot exists
-
getAllSSTables
- Returns:
- A list of open SSTableReaders
-
getAllSnapshots
-
getRepairManager
-
mockKS
-
dropCf
-
unload
public void unload(boolean dropData) Unloads all column family stores and releases metrics. -
initCfCustom
Registers a custom cf instance with this keyspace. This is required for offline tools what use non-standard directories. -
getWriteHandler
-
initCf
adds a cf to internal structures, ends up creating disk files). -
applyFuture
-
applyFuture
-
apply
-
apply
-
apply
public void apply(Mutation mutation, boolean makeDurable, boolean updateIndexes, boolean isDroppable) If apply is blocking, apply must not be deferred Otherwise there is a race condition where ALL mutation workers are beeing blocked ending in a complete deadlock of the mutation stage. See CASSANDRA-12689.- Parameters:
mutation- the row to write. Must not be modified after calling apply, since commitlog append may happen concurrently, depending on the CL Executor type.makeDurable- if true, don't return unless write has been made durableupdateIndexes- false to disable index updates (used by CollationController "defragmenting")isDroppable- true if this should throw WriteTimeoutException if it does not acquire lock within write_request_timeout
-
getReplicationStrategy
-
flush
-
getValidColumnFamilies
public Iterable<ColumnFamilyStore> getValidColumnFamilies(boolean allowIndexes, boolean autoAddIndexes, String... cfNames) -
all
-
allExisting
-
nonLocalStrategy
-
system
-
toString
-
getName
-