Skip to content

Commit

Permalink
Added snapshot file changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulSingh1895 committed Mar 5, 2024
1 parent 8e1088f commit 2589273
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/java/org/apache/cassandra/db/Directories.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 2589273

Please sign in to comment.