mirror of https://github.com/apache/cassandra
Expose data dirs to ColumnFamilyStoreMBean
Patch by Stefan Miklosovic; reviewed by marcuse for CASSANDRA-16335
This commit is contained in:
parent
309b3033d4
commit
0979bda958
|
|
@ -1,4 +1,5 @@
|
|||
4.0-beta5
|
||||
* Expose data dirs to ColumnFamilyStoreMBean (CASSANDRA-16335)
|
||||
* Add possibility to copy SSTables in SSTableImporter instead of moving them (CASSANDRA-16407)
|
||||
* Fix DESCRIBE statement for CUSTOM indices with options (CASSANDRA-16482)
|
||||
* Fix cassandra-stress JMX connection (CASSANDRA-16473)
|
||||
|
|
|
|||
|
|
@ -495,6 +495,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
return directories;
|
||||
}
|
||||
|
||||
public List<String> getDataPaths() throws IOException
|
||||
{
|
||||
List<String> dataPaths = new ArrayList<>();
|
||||
for (File dataPath : directories.getCFDirectories())
|
||||
{
|
||||
dataPaths.add(dataPath.getCanonicalPath());
|
||||
}
|
||||
|
||||
return dataPaths;
|
||||
}
|
||||
|
||||
public SSTableMultiWriter createSSTableMultiWriter(Descriptor descriptor, long keyCount, long repairedAt, UUID pendingRepair, boolean isTransient, int sstableLevel, SerializationHeader header, LifecycleNewTracker lifecycleNewTracker)
|
||||
{
|
||||
MetadataCollector collector = new MetadataCollector(metadata().comparator).sstableLevel(sstableLevel);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -248,4 +249,6 @@ public interface ColumnFamilyStoreMBean
|
|||
* If all SSTables are correctly placed or the partitioner does not support splitting, it returns false.
|
||||
*/
|
||||
public boolean hasMisplacedSSTables();
|
||||
|
||||
public List<String> getDataPaths() throws IOException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@ import java.io.File;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Assume;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
@ -458,6 +461,22 @@ public class ColumnFamilyStoreTest
|
|||
assert indexTableFile.endsWith(baseTableFile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDataDirectoriesOfColumnFamily() throws Exception
|
||||
{
|
||||
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE1).getColumnFamilyStore(CF_STANDARD1);
|
||||
List<String> dataPaths = cfs.getDataPaths();
|
||||
Assert.assertFalse(dataPaths.isEmpty());
|
||||
|
||||
Path path = Paths.get(dataPaths.get(0));
|
||||
|
||||
String keyspace = path.getParent().getFileName().toString();
|
||||
String table = path.getFileName().toString().split("-")[0];
|
||||
|
||||
Assert.assertEquals(cfs.getTableName(), table);
|
||||
Assert.assertEquals(KEYSPACE1, keyspace);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScrubDataDirectories() throws Throwable
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue