当前位置: 首页>>代码示例>>Java>>正文


Java ColumnFamilyStore.disableAutoCompaction方法代码示例

本文整理汇总了Java中org.apache.cassandra.db.ColumnFamilyStore.disableAutoCompaction方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnFamilyStore.disableAutoCompaction方法的具体用法?Java ColumnFamilyStore.disableAutoCompaction怎么用?Java ColumnFamilyStore.disableAutoCompaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.db.ColumnFamilyStore的用法示例。


在下文中一共展示了ColumnFamilyStore.disableAutoCompaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: antiCompactionSizeTest

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void antiCompactionSizeTest() throws ExecutionException, InterruptedException, IOException
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
    cfs.disableAutoCompaction();
    SSTableReader s = writeFile(cfs, 1000);
    cfs.addSSTable(s);
    long origSize = s.bytesOnDisk();
    Range<Token> range = new Range<Token>(new BytesToken(ByteBufferUtil.bytes(0)), new BytesToken(ByteBufferUtil.bytes(500)));
    Collection<SSTableReader> sstables = cfs.getSSTables();
    CompactionManager.instance.performAnticompaction(cfs, Arrays.asList(range), Refs.tryRef(sstables), 12345);
    long sum = 0;
    for (SSTableReader x : cfs.getSSTables())
        sum += x.bytesOnDisk();
    assertEquals(sum, cfs.metric.liveDiskSpaceUsed.count());
    assertEquals(origSize, cfs.metric.liveDiskSpaceUsed.count(), 100000);

}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:AntiCompactionTest.java

示例2: prepareColumnFamilyStore

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
private ColumnFamilyStore prepareColumnFamilyStore()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF);
    store.truncateBlocking();
    store.disableAutoCompaction();
    long timestamp = System.currentTimeMillis();
    for (int i = 0; i < 10; i++)
    {
        DecoratedKey key = Util.dk(Integer.toString(i));
        Mutation rm = new Mutation(KEYSPACE1, key.getKey());
        for (int j = 0; j < 10; j++)
            rm.add("Standard1", Util.cellname(Integer.toString(j)),
                   ByteBufferUtil.EMPTY_BYTE_BUFFER,
                   timestamp,
                   0);
        rm.apply();
    }
    store.forceBlockingFlush();
    return store;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:AntiCompactionTest.java

示例3: minorNeverPurgeTombstonesTest

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void minorNeverPurgeTombstonesTest() throws Throwable
{
    createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, b)) WITH gc_grace_seconds = 0");
    ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
    cfs.disableAutoCompaction();
    for (int i = 0; i < 4; i++)
    {
        for (int j = 0; j < 1000; j++)
        {
            execute("INSERT INTO %s (a, b, c) VALUES (" + j + ", 2, '3')");
        }
        cfs.forceBlockingFlush();
    }

    execute("UPDATE %s SET c = null WHERE a=1 AND b=2");
    execute("DELETE FROM %s WHERE a=2 AND b=2");
    execute("DELETE FROM %s WHERE a=3");
    cfs.forceBlockingFlush();
    cfs.enableAutoCompaction();
    while (cfs.getLiveSSTables().size() > 1)
        Thread.sleep(100);
    verifyContainsTombstones(cfs.getLiveSSTables(), 3);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:NeverPurgeTest.java

示例4: testSSTableSplit

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testSSTableSplit() throws InterruptedException
{
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
    truncate(cfs);
    cfs.disableAutoCompaction();
    SSTableReader s = writeFile(cfs, 1000);
    try (LifecycleTransaction txn = LifecycleTransaction.offline(OperationType.UNKNOWN, s))
    {
        SSTableSplitter splitter = new SSTableSplitter(cfs, txn, 10);
        splitter.split();

        assertFileCounts(s.descriptor.directory.list());
        LifecycleTransaction.waitForDeletions();

        for (File f : s.descriptor.directory.listFiles())
        {
            // we need to clear out the data dir, otherwise tests running after this breaks
            FileUtils.deleteRecursive(f);
        }
    }
    truncate(cfs);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:SSTableRewriterTest.java

示例5: disableAutoCompaction

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
public void disableAutoCompaction(String ks, String... columnFamilies) throws IOException
{
    for (ColumnFamilyStore cfs : getValidColumnFamilies(true, true, ks, columnFamilies))
    {
        cfs.disableAutoCompaction();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:StorageService.java

示例6: disableAutoCompaction

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
public void disableAutoCompaction()
{
    for (String ksname : Schema.instance.getNonSystemKeyspaces())
    {
        for (ColumnFamilyStore cfs : Keyspace.open(ksname).getColumnFamilyStores())
            cfs.disableAutoCompaction();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:CompactionManager.java

示例7: testFilterOldSSTables

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testFilterOldSSTables()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1);
    cfs.truncateBlocking();
    cfs.disableAutoCompaction();

    ByteBuffer value = ByteBuffer.wrap(new byte[100]);

    // create 3 sstables
    int numSSTables = 3;
    for (int r = 0; r < numSSTables; r++)
    {
        DecoratedKey key = Util.dk(String.valueOf(r));
        Mutation rm = new Mutation(KEYSPACE1, key.getKey());
        rm.add(CF_STANDARD1, Util.cellname("column"), value, r);
        rm.apply();
        cfs.forceBlockingFlush();
    }
    cfs.forceBlockingFlush();

    Iterable<SSTableReader> filtered;
    List<SSTableReader> sstrs = new ArrayList<>(cfs.getSSTables());

    filtered = filterOldSSTables(sstrs, 0, 2);
    assertEquals("when maxSSTableAge is zero, no sstables should be filtered", sstrs.size(), Iterables.size(filtered));

    filtered = filterOldSSTables(sstrs, 1, 2);
    assertEquals("only the newest 2 sstables should remain", 2, Iterables.size(filtered));

    filtered = filterOldSSTables(sstrs, 1, 3);
    assertEquals("only the newest sstable should remain", 1, Iterables.size(filtered));

    filtered = filterOldSSTables(sstrs, 1, 4);
    assertEquals("no sstables should remain when all are too old", 0, Iterables.size(filtered));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:38,代码来源:DateTieredCompactionStrategyTest.java

示例8: prepareColumnFamilyStore

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
private ColumnFamilyStore prepareColumnFamilyStore()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE5);
    ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARD1);
    store.truncateBlocking();
    store.disableAutoCompaction();
    createSSTables(store, 10);
    return store;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:ActiveRepairServiceTest.java

示例9: testPrepBucket

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testPrepBucket()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1);
    cfs.disableAutoCompaction();

    ByteBuffer value = ByteBuffer.wrap(new byte[100]);

    // create 3 sstables
    int numSSTables = 3;
    for (int r = 0; r < numSSTables; r++)
    {
        DecoratedKey key = Util.dk(String.valueOf(r));
        new RowUpdateBuilder(cfs.metadata, r, key.getKey())
            .clustering("column")
            .add("val", value).build().applyUnsafe();

        cfs.forceBlockingFlush();
    }
    cfs.forceBlockingFlush();

    List<SSTableReader> sstrs = new ArrayList<>(cfs.getLiveSSTables());

    List<SSTableReader> newBucket = newestBucket(Collections.singletonList(sstrs.subList(0, 2)), 4, 32, 9, 10, Long.MAX_VALUE, new SizeTieredCompactionStrategyOptions());
    assertTrue("incoming bucket should not be accepted when it has below the min threshold SSTables", newBucket.isEmpty());

    newBucket = newestBucket(Collections.singletonList(sstrs.subList(0, 2)), 4, 32, 10, 10, Long.MAX_VALUE, new SizeTieredCompactionStrategyOptions());
    assertFalse("non-incoming bucket should be accepted when it has at least 2 SSTables", newBucket.isEmpty());

    assertEquals("an sstable with a single value should have equal min/max timestamps", sstrs.get(0).getMinTimestamp(), sstrs.get(0).getMaxTimestamp());
    assertEquals("an sstable with a single value should have equal min/max timestamps", sstrs.get(1).getMinTimestamp(), sstrs.get(1).getMaxTimestamp());
    assertEquals("an sstable with a single value should have equal min/max timestamps", sstrs.get(2).getMinTimestamp(), sstrs.get(2).getMaxTimestamp());
    cfs.truncateBlocking();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:36,代码来源:DateTieredCompactionStrategyTest.java

示例10: testFilterOldSSTables

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testFilterOldSSTables()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1);
    cfs.disableAutoCompaction();

    ByteBuffer value = ByteBuffer.wrap(new byte[100]);

    // create 3 sstables
    int numSSTables = 3;
    for (int r = 0; r < numSSTables; r++)
    {
        DecoratedKey key = Util.dk(String.valueOf(r));
        new RowUpdateBuilder(cfs.metadata, r, key.getKey())
            .clustering("column")
            .add("val", value).build().applyUnsafe();

        cfs.forceBlockingFlush();
    }
    cfs.forceBlockingFlush();

    Iterable<SSTableReader> filtered;
    List<SSTableReader> sstrs = new ArrayList<>(cfs.getLiveSSTables());

    filtered = filterOldSSTables(sstrs, 0, 2);
    assertEquals("when maxSSTableAge is zero, no sstables should be filtered", sstrs.size(), Iterables.size(filtered));

    filtered = filterOldSSTables(sstrs, 1, 2);
    assertEquals("only the newest 2 sstables should remain", 2, Iterables.size(filtered));

    filtered = filterOldSSTables(sstrs, 1, 3);
    assertEquals("only the newest sstable should remain", 1, Iterables.size(filtered));

    filtered = filterOldSSTables(sstrs, 1, 4);
    assertEquals("no sstables should remain when all are too old", 0, Iterables.size(filtered));
    cfs.truncateBlocking();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:39,代码来源:DateTieredCompactionStrategyTest.java

示例11: testNumberOfFiles_truncate

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testNumberOfFiles_truncate() throws Exception
{
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
    truncate(cfs);
    cfs.disableAutoCompaction();

    SSTableReader s = writeFile(cfs, 1000);
    cfs.addSSTable(s);
    Set<SSTableReader> compacting = Sets.newHashSet(s);

    List<SSTableReader> sstables;
    int files = 1;
    try (ISSTableScanner scanner = s.getScanner();
         CompactionController controller = new CompactionController(cfs, compacting, 0);
         LifecycleTransaction txn = cfs.getTracker().tryModify(compacting, OperationType.UNKNOWN);
         SSTableRewriter rewriter = new SSTableRewriter(txn, 1000, false, 10000000, false);
         CompactionIterator ci = new CompactionIterator(OperationType.COMPACTION, Collections.singletonList(scanner), controller, FBUtilities.nowInSeconds(), UUIDGen.getTimeUUID()))
    {
        rewriter.switchWriter(getWriter(cfs, s.descriptor.directory, txn));
        while(ci.hasNext())
        {
            rewriter.append(ci.next());
            if (rewriter.currentWriter().getOnDiskFilePointer() > 25000000)
            {
                rewriter.switchWriter(getWriter(cfs, s.descriptor.directory, txn));
                files++;
                assertEquals(cfs.getLiveSSTables().size(), files); // we have one original file plus the ones we have switched out.
            }
        }

        sstables = rewriter.finish();
    }

    LifecycleTransaction.waitForDeletions();
    assertFileCounts(s.descriptor.directory.list());
    validateCFS(cfs);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:40,代码来源:SSTableRewriterTest.java

示例12: createSSTables

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
private void createSSTables(String ksname, String cfname, int numSSTables, int numPartition)
{
    Keyspace keyspace = Keyspace.open(ksname);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);
    cfs.truncateBlocking();
    cfs.disableAutoCompaction();

    ArrayList<Future> futures = new ArrayList<>(numSSTables);
    ByteBuffer value = ByteBuffer.wrap(new byte[100]);
    for (int sstable = 0; sstable < numSSTables; sstable++)
    {
        for (int p = 0; p < numPartition; p++)
        {

            String key = String.format("%3d", p);
            new RowUpdateBuilder(cfs.metadata, 0, key)
                .clustering("column")
                .add("val", value)
                .build()
                .applyUnsafe();
        }
        futures.add(cfs.forceFlush());
    }
    for (Future future : futures)
    {
        try
        {
            future.get();
        } catch (InterruptedException | ExecutionException e)
        {
            throw new RuntimeException(e);
        }
    }
    assertEquals(numSSTables, cfs.getLiveSSTables().size());
    validateData(cfs, numPartition);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:37,代码来源:IndexSummaryManagerTest.java

示例13: testSingleKeyMultipleRanges

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testSingleKeyMultipleRanges() throws IOException
{
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore store = keyspace.getColumnFamilyStore(TABLE);
    store.clearUnsafe();

    // disable compaction while flushing
    store.disableAutoCompaction();

    insertRowWithKey(store.metadata, 205);
    store.forceBlockingFlush();

    assertEquals(1, store.getLiveSSTables().size());
    SSTableReader sstable = store.getLiveSSTables().iterator().next();

    // full range scan
    ISSTableScanner fullScanner = sstable.getScanner(RateLimiter.create(Double.MAX_VALUE));
    assertScanContainsRanges(fullScanner, 205, 205);

    // scan three ranges separately
    ISSTableScanner scanner = sstable.getScanner(makeRanges(101, 109,
                                                               201, 209), null);

    // this will currently fail
    assertScanContainsRanges(scanner, 205, 205);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:28,代码来源:SSTableScannerTest.java

示例14: testPrepBucket

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testPrepBucket()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1);
    cfs.truncateBlocking();
    cfs.disableAutoCompaction();

    ByteBuffer value = ByteBuffer.wrap(new byte[100]);

    // create 3 sstables
    int numSSTables = 3;
    for (int r = 0; r < numSSTables; r++)
    {
        DecoratedKey key = Util.dk(String.valueOf(r));
        Mutation rm = new Mutation(KEYSPACE1, key.getKey());
        rm.add(CF_STANDARD1, Util.cellname("column"), value, r);
        rm.apply();
        cfs.forceBlockingFlush();
    }
    cfs.forceBlockingFlush();

    List<SSTableReader> sstrs = new ArrayList<>(cfs.getSSTables());

    List<SSTableReader> newBucket = newestBucket(Collections.singletonList(sstrs.subList(0, 2)), 4, 32, 9, 10);
    assertTrue("incoming bucket should not be accepted when it has below the min threshold SSTables", newBucket.isEmpty());

    newBucket = newestBucket(Collections.singletonList(sstrs.subList(0, 2)), 4, 32, 10, 10);
    assertFalse("non-incoming bucket should be accepted when it has at least 2 SSTables", newBucket.isEmpty());

    assertEquals("an sstable with a single value should have equal min/max timestamps", sstrs.get(0).getMinTimestamp(), sstrs.get(0).getMaxTimestamp());
    assertEquals("an sstable with a single value should have equal min/max timestamps", sstrs.get(1).getMinTimestamp(), sstrs.get(1).getMaxTimestamp());
    assertEquals("an sstable with a single value should have equal min/max timestamps", sstrs.get(2).getMinTimestamp(), sstrs.get(2).getMaxTimestamp());

    // if we have more than the max threshold, the oldest should be dropped
    Collections.sort(sstrs, Collections.reverseOrder(new Comparator<SSTableReader>() {
        public int compare(SSTableReader o1, SSTableReader o2) {
            return Long.compare(o1.getMinTimestamp(), o2.getMinTimestamp()) ;
        }
    }));

    List<SSTableReader> bucket = trimToThreshold(sstrs, 2);
    assertEquals("one bucket should have been dropped", 2, bucket.size());
    for (SSTableReader sstr : bucket)
        assertFalse("the oldest sstable should be dropped", sstr.getMinTimestamp() == 0);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:47,代码来源:DateTieredCompactionStrategyTest.java

示例15: testPrepBucket

import org.apache.cassandra.db.ColumnFamilyStore; //导入方法依赖的package包/类
@Test
public void testPrepBucket() throws Exception
{
    String ksname = KEYSPACE1;
    String cfname = "Standard1";
    Keyspace keyspace = Keyspace.open(ksname);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);
    cfs.truncateBlocking();
    cfs.disableAutoCompaction();

    ByteBuffer value = ByteBuffer.wrap(new byte[100]);

    // create 3 sstables
    int numSSTables = 3;
    for (int r = 0; r < numSSTables; r++)
    {
        String key = String.valueOf(r);
        new RowUpdateBuilder(cfs.metadata, 0, key)
            .clustering("column").add("val", value)
            .build().applyUnsafe();
        cfs.forceBlockingFlush();
    }
    cfs.forceBlockingFlush();

    List<SSTableReader> sstrs = new ArrayList<>(cfs.getLiveSSTables());
    Pair<List<SSTableReader>, Double> bucket;

    List<SSTableReader> interestingBucket = mostInterestingBucket(Collections.singletonList(sstrs.subList(0, 2)), 4, 32);
    assertTrue("nothing should be returned when all buckets are below the min threshold", interestingBucket.isEmpty());

    sstrs.get(0).overrideReadMeter(new RestorableMeter(100.0, 100.0));
    sstrs.get(1).overrideReadMeter(new RestorableMeter(200.0, 200.0));
    sstrs.get(2).overrideReadMeter(new RestorableMeter(300.0, 300.0));

    long estimatedKeys = sstrs.get(0).estimatedKeys();

    // if we have more than the max threshold, the coldest should be dropped
    bucket = trimToThresholdWithHotness(sstrs, 2);
    assertEquals("one bucket should have been dropped", 2, bucket.left.size());
    double expectedBucketHotness = (200.0 + 300.0) / estimatedKeys;
    assertEquals(String.format("bucket hotness (%f) should be close to %f", bucket.right, expectedBucketHotness),
                 expectedBucketHotness, bucket.right, 1.0);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:44,代码来源:SizeTieredCompactionStrategyTest.java


注:本文中的org.apache.cassandra.db.ColumnFamilyStore.disableAutoCompaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。