diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16905696b65b..70a1ba84ba12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,7 @@ on: - juspay-4.2 - cassandra-4.1 - feature/cassandra-4-1-5 + - feature/with-snapshot-changes jobs: build: runs-on: ubuntu-latest diff --git a/src/java/org/apache/cassandra/db/Directories.java b/src/java/org/apache/cassandra/db/Directories.java index b16dd972f10d..551708040f09 100644 --- a/src/java/org/apache/cassandra/db/Directories.java +++ b/src/java/org/apache/cassandra/db/Directories.java @@ -559,15 +559,20 @@ public static File getSnapshotDirectory(Descriptor desc, String snapshotName) * @param snapshotName snapshot name * @return directory to write snapshot */ - public static File getSnapshotDirectory(File location, String snapshotName) + public static File getSnapshotDirectory(File originalLocation, String snapshotName) { + // Getting data directory + File location = new File(originalLocation.toString().replaceFirst("(.+)/([^/]+)/([^/]+)$", "$1")); + // Getting keyspace & table direct name + String keyspaceTable = originalLocation.toString().replaceFirst("(.+)/(([^/]+)/([^/]+))$", "$2"); + if (isSecondaryIndexFolder(location)) { return getOrCreate(location.parent(), SNAPSHOT_SUBDIR, snapshotName, location.name()); } else { - return getOrCreate(location, SNAPSHOT_SUBDIR, snapshotName); + return getOrCreate(location, SNAPSHOT_SUBDIR, snapshotName, keyspaceTable); } }