public static String getTimestampedSnapshotNameWithPrefix(String clientSuppliedName, String prefix) { return prefix + "-" + getTimestampedSnapshotName(clientSuppliedName); }
public static String getTimestampedSnapshotNameWithPrefix(String clientSuppliedName, String prefix) { return prefix + "-" + getTimestampedSnapshotName(clientSuppliedName); }
public static String getTimestampedSnapshotNameWithPrefix(String clientSuppliedName, String prefix) { return prefix + "-" + getTimestampedSnapshotName(clientSuppliedName); }
/** * Compare the release version in the system.local table with the one included in the distro. * If they don't match, snapshot all tables in the system keyspace. This is intended to be * called at startup to create a backup of the system tables during an upgrade * * @throws IOException */ public static boolean snapshotOnVersionChange() throws IOException { String previous = getPreviousVersionString(); String next = FBUtilities.getReleaseVersionString(); // if we're restarting after an upgrade, snapshot the system keyspace if (!previous.equals(NULL_VERSION.toString()) && !previous.equals(next)) { logger.info("Detected version upgrade from {} to {}, snapshotting system keyspace", previous, next); String snapshotName = Keyspace.getTimestampedSnapshotName(String.format("upgrade-%s-%s", previous, next)); Keyspace systemKs = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME); systemKs.snapshot(snapshotName, null); return true; } return false; }
/** * Compare the release version in the system.local table with the one included in the distro. * If they don't match, snapshot all tables in the system keyspace. This is intended to be * called at startup to create a backup of the system tables during an upgrade * * @throws IOException */ public static boolean snapshotOnVersionChange() throws IOException { String previous = getPreviousVersionString(); String next = FBUtilities.getReleaseVersionString(); // if we're restarting after an upgrade, snapshot the system keyspace if (!previous.equals(NULL_VERSION.toString()) && !previous.equals(next)) { logger.info("Detected version upgrade from {} to {}, snapshotting system keyspace", previous, next); String snapshotName = Keyspace.getTimestampedSnapshotName(String.format("upgrade-%s-%s", previous, next)); Keyspace systemKs = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME); systemKs.snapshot(snapshotName, null); return true; } return false; }
/** * Compare the release version in the system.local table with the one included in the distro. * If they don't match, snapshot all tables in the system keyspace. This is intended to be * called at startup to create a backup of the system tables during an upgrade * * @throws IOException */ public static boolean snapshotOnVersionChange() throws IOException { String previous = getPreviousVersionString(); String next = FBUtilities.getReleaseVersionString(); // if we're restarting after an upgrade, snapshot the system keyspace if (!previous.equals(NULL_VERSION.toString()) && !previous.equals(next)) { logger.info("Detected version upgrade from {} to {}, snapshotting system keyspace", previous, next); String snapshotName = Keyspace.getTimestampedSnapshotName(String.format("upgrade-%s-%s", previous, next)); Keyspace systemKs = Keyspace.open(SchemaConstants.SYSTEM_KEYSPACE_NAME); systemKs.snapshot(snapshotName, null); return true; } return false; }
public void run() { logger.debug("Discarding sstable data for truncated CF + indexes"); final long truncatedAt = System.currentTimeMillis(); data.notifyTruncated(truncatedAt); if (DatabaseDescriptor.isAutoSnapshot()) snapshot(Keyspace.getTimestampedSnapshotName(name)); ReplayPosition replayAfter = discardSSTables(truncatedAt); for (SecondaryIndex index : indexManager.getIndexes()) index.truncateBlocking(truncatedAt); SystemKeyspace.saveTruncationRecord(ColumnFamilyStore.this, truncatedAt, replayAfter); logger.debug("cleaning out row cache"); invalidateCaches(); } };
private static void dropColumnFamily(String ksName, String cfName) { KSMetaData ksm = Schema.instance.getKSMetaData(ksName); assert ksm != null; ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(cfName); assert cfs != null; // reinitialize the keyspace. CFMetaData cfm = ksm.cfMetaData().get(cfName); Schema.instance.purge(cfm); Schema.instance.setKeyspaceDefinition(makeNewKeyspaceDefinition(ksm, cfm)); CompactionManager.instance.interruptCompactionFor(Arrays.asList(cfm), true); if (!StorageService.instance.isClientMode()) { if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(Keyspace.getTimestampedSnapshotName(cfs.name)); Keyspace.open(ksm.name).dropCf(cfm.cfId); MigrationManager.instance.notifyDropColumnFamily(cfm); CommitLog.instance.forceRecycleAllSegments(Collections.singleton(cfm.cfId)); } }
public void dropView(String ksName, String viewName) { KeyspaceMetadata oldKsm = getKSMetaData(ksName); assert oldKsm != null; ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(viewName); assert cfs != null; // make sure all the indexes are dropped, or else. cfs.indexManager.markAllIndexesRemoved(); // reinitialize the keyspace. ViewDefinition view = oldKsm.views.get(viewName).get(); KeyspaceMetadata newKsm = oldKsm.withSwapped(oldKsm.views.without(viewName)); unload(view); setKeyspaceMetadata(newKsm); CompactionManager.instance.interruptCompactionFor(Collections.singleton(view.metadata), true); if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(Keyspace.getTimestampedSnapshotName(cfs.name)); Keyspace.open(ksName).dropCf(view.metadata.cfId); Keyspace.open(ksName).viewManager.reload(); MigrationManager.instance.notifyDropView(view); CommitLog.instance.forceRecycleAllSegments(Collections.singleton(view.metadata.cfId)); }
public void dropView(String ksName, String viewName) { KeyspaceMetadata oldKsm = getKSMetaData(ksName); assert oldKsm != null; ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(viewName); assert cfs != null; // make sure all the indexes are dropped, or else. cfs.indexManager.markAllIndexesRemoved(); // reinitialize the keyspace. ViewDefinition view = oldKsm.views.get(viewName).get(); KeyspaceMetadata newKsm = oldKsm.withSwapped(oldKsm.views.without(viewName)); unload(view); setKeyspaceMetadata(newKsm); CompactionManager.instance.interruptCompactionFor(Collections.singleton(view.metadata), true); if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(Keyspace.getTimestampedSnapshotName(cfs.name)); Keyspace.open(ksName).dropCf(view.metadata.cfId); Keyspace.open(ksName).viewManager.reload(); MigrationManager.instance.notifyDropView(view); CommitLog.instance.forceRecycleAllSegments(Collections.singleton(view.metadata.cfId)); }
private static void dropKeyspace(String ksName) String snapshotName = Keyspace.getTimestampedSnapshotName(ksName);
public void dropView(String ksName, String viewName) { KeyspaceMetadata oldKsm = getKSMetaData(ksName); assert oldKsm != null; ColumnFamilyStore cfs = Keyspace.open(ksName).getColumnFamilyStore(viewName); assert cfs != null; // make sure all the indexes are dropped, or else. cfs.indexManager.markAllIndexesRemoved(); // reinitialize the keyspace. ViewDefinition view = oldKsm.views.get(viewName).get(); KeyspaceMetadata newKsm = oldKsm.withSwapped(oldKsm.views.without(viewName)); unload(view); setKeyspaceMetadata(newKsm); CompactionManager.instance.interruptCompactionFor(Collections.singleton(view.metadata), true); if (DatabaseDescriptor.isAutoSnapshot()) cfs.snapshot(Keyspace.getTimestampedSnapshotName(cfs.name)); Keyspace.open(ksName).dropCf(view.metadata.cfId); Keyspace.open(ksName).viewManager.reload(); MigrationManager.instance.notifyDropView(view); CommitLog.instance.forceRecycleAllSegments(Collections.singleton(view.metadata.cfId)); }