MigrationManager.instance.notifyDropKeyspace(ksm);
public void dropKeyspace(String ksName) { KeyspaceMetadata ksm = Schema.instance.getKSMetaData(ksName); String snapshotName = Keyspace.getTimestampedSnapshotNameWithPrefix(ksName, ColumnFamilyStore.SNAPSHOT_DROP_PREFIX); CompactionManager.instance.interruptCompactionFor(ksm.tablesAndViews(), true); Keyspace keyspace = Keyspace.open(ksm.name); // remove all cfs from the keyspace instance. List<UUID> droppedCfs = new ArrayList<>(); for (CFMetaData cfm : ksm.tablesAndViews()) { ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfm.cfName); unload(cfm); if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(snapshotName); Keyspace.open(ksm.name).dropCf(cfm.cfId); droppedCfs.add(cfm.cfId); } // remove the keyspace from the static instances. Keyspace.clear(ksm.name); clearKeyspaceMetadata(ksm); Keyspace.writeOrder.awaitNewBarrier(); // force a new segment in the CL CommitLog.instance.forceRecycleAllSegments(droppedCfs); MigrationManager.instance.notifyDropKeyspace(ksm); }
public void dropKeyspace(String ksName) { KeyspaceMetadata ksm = Schema.instance.getKSMetaData(ksName); String snapshotName = Keyspace.getTimestampedSnapshotNameWithPrefix(ksName, ColumnFamilyStore.SNAPSHOT_DROP_PREFIX); CompactionManager.instance.interruptCompactionFor(ksm.tablesAndViews(), true); Keyspace keyspace = Keyspace.open(ksm.name); // remove all cfs from the keyspace instance. List<UUID> droppedCfs = new ArrayList<>(); for (CFMetaData cfm : ksm.tablesAndViews()) { ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfm.cfName); unload(cfm); if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(snapshotName); Keyspace.open(ksm.name).dropCf(cfm.cfId); droppedCfs.add(cfm.cfId); } // remove the keyspace from the static instances. Keyspace.clear(ksm.name); clearKeyspaceMetadata(ksm); Keyspace.writeOrder.awaitNewBarrier(); // force a new segment in the CL CommitLog.instance.forceRecycleAllSegments(droppedCfs); MigrationManager.instance.notifyDropKeyspace(ksm); }
public void dropKeyspace(String ksName) { KeyspaceMetadata ksm = Schema.instance.getKSMetaData(ksName); String snapshotName = Keyspace.getTimestampedSnapshotNameWithPrefix(ksName, ColumnFamilyStore.SNAPSHOT_DROP_PREFIX); CompactionManager.instance.interruptCompactionFor(ksm.tablesAndViews(), true); Keyspace keyspace = Keyspace.open(ksm.name); // remove all cfs from the keyspace instance. List<UUID> droppedCfs = new ArrayList<>(); for (CFMetaData cfm : ksm.tablesAndViews()) { ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfm.cfName); unload(cfm); if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(snapshotName); Keyspace.open(ksm.name).dropCf(cfm.cfId); droppedCfs.add(cfm.cfId); } // remove the keyspace from the static instances. Keyspace.clear(ksm.name); clearKeyspaceMetadata(ksm); Keyspace.writeOrder.awaitNewBarrier(); // force a new segment in the CL CommitLog.instance.forceRecycleAllSegments(droppedCfs); MigrationManager.instance.notifyDropKeyspace(ksm); }