pauloricardomg commented on a change in pull request #1046:
URL: https://github.com/apache/cassandra/pull/1046#discussion_r682987478
##########
File path: src/java/org/apache/cassandra/db/ColumnFamilyStore.java
##########
@@ -1857,41 +1857,65 @@ public void snapshotWithoutFlush(String snapshotName)
}
}
- writeSnapshotManifest(filesJSONArr, snapshotName);
+ return createSnapshot(snapshotName, ephemeral, ttl,
snapshottedSSTables);
+ }
+
+ protected TableSnapshot createSnapshot(String tag, boolean ephemeral,
Duration ttl, Set<SSTableReader> sstables) {
+ Set<File> snapshotDirs = sstables.stream()
+ .map(s ->
Directories.getSnapshotDirectory(s.descriptor, tag))
+
.collect(Collectors.toCollection(HashSet::new));
+
+ // Create and write snapshot manifest
+ SnapshotManifest manifest = new
SnapshotManifest(mapToDataFilenames(sstables), ttl);
+ File manifestFile = getDirectories().getSnapshotManifestFile(tag);
+ writeSnapshotManifest(manifest, manifestFile);
+ snapshotDirs.add(manifestFile.getParentFile()); // manifest may create
empty snapshot dir
+
+ // Write snapshot schema
if (!SchemaConstants.isLocalSystemKeyspace(metadata.keyspace) &&
!SchemaConstants.isReplicatedSystemKeyspace(metadata.keyspace))
- writeSnapshotSchema(snapshotName);
+ {
+ File schemaFile = getDirectories().getSnapshotSchemaFile(tag);
+ writeSnapshotSchema(schemaFile);
+ snapshotDirs.add(schemaFile.getParentFile()); // schema may create
empty snapshot dir
+ }
+
+ // Maybe create ephemeral marker
+ if (ephemeral) {
Review comment:
move bracket to next line
##########
File path: src/java/org/apache/cassandra/config/CassandraRelevantProperties.java
##########
@@ -177,9 +177,19 @@
/** This property indicates whether disable_mbean_registration is true */
IS_DISABLED_MBEAN_REGISTRATION("org.apache.cassandra.disable_mbean_registration"),
+ /** snapshots ttl cleanup period in seconds */
+
SNAPSHOT_CLEANUP_PERIOD_SECONDS("cassandra.snapshot.ttl_cleanup_period_seconds",
"5"),
Review comment:
change default cleanup period to 60 seconds
##########
File path: build.xml
##########
@@ -760,7 +761,7 @@
<dependency groupId="com.fasterxml.jackson.core"
artifactId="jackson-core"/>
<dependency groupId="com.fasterxml.jackson.core"
artifactId="jackson-databind"/>
<dependency groupId="com.fasterxml.jackson.core"
artifactId="jackson-annotations"/>
- <dependency groupId="com.googlecode.json-simple"
artifactId="json-simple"/>
+ <dependency groupId="com.googlecode.json-simple"
artifactId="json-simple"/>
Review comment:
remove unnecessary space
##########
File path: src/java/org/apache/cassandra/io/util/FileUtils.java
##########
@@ -38,6 +38,7 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;
+import java.util.Map;
Review comment:
remove modifications to this file
##########
File path: src/java/org/apache/cassandra/db/ColumnFamilyStore.java
##########
@@ -1857,41 +1857,65 @@ public void snapshotWithoutFlush(String snapshotName)
}
}
- writeSnapshotManifest(filesJSONArr, snapshotName);
+ return createSnapshot(snapshotName, ephemeral, ttl,
snapshottedSSTables);
+ }
+
+ protected TableSnapshot createSnapshot(String tag, boolean ephemeral,
Duration ttl, Set<SSTableReader> sstables) {
+ Set<File> snapshotDirs = sstables.stream()
+ .map(s ->
Directories.getSnapshotDirectory(s.descriptor, tag))
+
.collect(Collectors.toCollection(HashSet::new));
+
+ // Create and write snapshot manifest
+ SnapshotManifest manifest = new
SnapshotManifest(mapToDataFilenames(sstables), ttl);
+ File manifestFile = getDirectories().getSnapshotManifestFile(tag);
+ writeSnapshotManifest(manifest, manifestFile);
+ snapshotDirs.add(manifestFile.getParentFile()); // manifest may create
empty snapshot dir
+
+ // Write snapshot schema
if (!SchemaConstants.isLocalSystemKeyspace(metadata.keyspace) &&
!SchemaConstants.isReplicatedSystemKeyspace(metadata.keyspace))
- writeSnapshotSchema(snapshotName);
+ {
+ File schemaFile = getDirectories().getSnapshotSchemaFile(tag);
+ writeSnapshotSchema(schemaFile);
+ snapshotDirs.add(schemaFile.getParentFile()); // schema may create
empty snapshot dir
+ }
+
+ // Maybe create ephemeral marker
+ if (ephemeral) {
Review comment:
please address this
##########
File path: src/java/org/apache/cassandra/config/CassandraRelevantProperties.java
##########
@@ -177,9 +177,19 @@
/** This property indicates whether disable_mbean_registration is true */
IS_DISABLED_MBEAN_REGISTRATION("org.apache.cassandra.disable_mbean_registration"),
+ /** snapshots ttl cleanup period in seconds */
+
SNAPSHOT_CLEANUP_PERIOD_SECONDS("cassandra.snapshot.ttl_cleanup_period_seconds",
"5"),
Review comment:
please address this
##########
File path: build.xml
##########
@@ -758,6 +759,7 @@
<dependency groupId="com.fasterxml.jackson.core"
artifactId="jackson-core"/>
<dependency groupId="com.fasterxml.jackson.core"
artifactId="jackson-databind"/>
<dependency groupId="com.fasterxml.jackson.core"
artifactId="jackson-annotations"/>
+ <dependency groupId="com.fasterxml.jackson.datatype"
artifactId="jackson-datatype-jsr310" version="2.9.10"/>
Review comment:
no need to specify version here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]