Skip to content

Commit 50dad4f

Browse files
committed
CNDB-16135: reuse table directory from Directories into Descriptor (#2150)
### What is the issue CNDB-16135: Descriptor uses different instances of `Path directory` for the same table as constructor parameter ### What does this PR fix and why was it fixed Use the table directory from `Directories` in `Descriptor` as constructor parameter . `Descriptor#directory` is still different instance in C* due to `directory#toCanonical()` which always creates new instance in local file system
1 parent 6020505 commit 50dad4f

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/java/org/apache/cassandra/db/Directories.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public Descriptor resolve(String filename, int dirNumber)
390390
{
391391
Preconditions.checkArgument(dirNumber < dataPaths.length, "Invalid dir number: " + dirNumber);
392392
File dir = dataPaths[dirNumber];
393-
return Descriptor.fromFileWithComponent(new File(dir, filename), true).left;
393+
return Descriptor.fromFileWithComponent(dir, filename, true).left;
394394
}
395395

396396
/**

src/java/org/apache/cassandra/io/sstable/Descriptor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ public static Pair<Descriptor, Component> fromFileWithComponent(File file, boole
373373
if (!file.isAbsolute())
374374
file = file.toAbsolute();
375375

376-
SSTableInfo info = validateAndExtractInfo(file);
377376
String filename = file.name();
378377
File tableDirectory = parentOf(filename, file);
379378

@@ -433,7 +432,6 @@ public static Pair<Descriptor, Component> fromFileWithComponent(File tableDirect
433432
}
434433
else if (validateDirs)
435434
{
436-
logger.debug("Could not extract keyspace/table info from sstable directory {}", file.toString());
437435
logger.debug("Could not extract keyspace/table info from sstable directory {}", fullPath);
438436
throw invalidSSTable(name, String.format("cannot extract keyspace and table name from %s; make sure the sstable is in the proper sub-directories", fullPath));
439437
}

0 commit comments

Comments
 (0)