Search in sources :

Example 6 with SSTableAddedNotification

use of org.apache.cassandra.notifications.SSTableAddedNotification in project cassandra by apache.

the class CompactionStrategyManagerPendingRepairTest method sstableDeleted.

@Test
public void sstableDeleted() {
    UUID repairID = registerSession(cfs, true, true);
    LocalSessionAccessor.prepareUnsafe(repairID, COORDINATOR, PARTICIPANTS);
    SSTableReader sstable = makeSSTable(true);
    mutateRepaired(sstable, repairID);
    csm.handleNotification(new SSTableAddedNotification(Collections.singleton(sstable)), cfs.getTracker());
    Assert.assertTrue(pendingContains(repairID, sstable));
    // delete sstable
    SSTableDeletingNotification notification = new SSTableDeletingNotification(sstable);
    csm.handleNotification(notification, cfs.getTracker());
    Assert.assertFalse(pendingContains(repairID, sstable));
    Assert.assertFalse(unrepairedContains(sstable));
    Assert.assertFalse(repairedContains(sstable));
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) SSTableDeletingNotification(org.apache.cassandra.notifications.SSTableDeletingNotification) SSTableAddedNotification(org.apache.cassandra.notifications.SSTableAddedNotification) UUID(java.util.UUID) Test(org.junit.Test)

Example 7 with SSTableAddedNotification

use of org.apache.cassandra.notifications.SSTableAddedNotification in project cassandra by apache.

the class CompactionStrategyManagerPendingRepairTest method getStrategies.

/**
     * CompactionStrategyManager.getStrategies should include
     * pending repair strategies when appropriate
     */
@Test
public void getStrategies() {
    UUID repairID = registerSession(cfs, true, true);
    LocalSessionAccessor.prepareUnsafe(repairID, COORDINATOR, PARTICIPANTS);
    List<List<AbstractCompactionStrategy>> strategies;
    strategies = csm.getStrategies();
    Assert.assertEquals(3, strategies.size());
    Assert.assertTrue(strategies.get(2).isEmpty());
    SSTableReader sstable = makeSSTable(true);
    mutateRepaired(sstable, repairID);
    csm.handleNotification(new SSTableAddedNotification(Collections.singleton(sstable)), cfs.getTracker());
    strategies = csm.getStrategies();
    Assert.assertEquals(3, strategies.size());
    Assert.assertFalse(strategies.get(2).isEmpty());
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) List(java.util.List) SSTableAddedNotification(org.apache.cassandra.notifications.SSTableAddedNotification) UUID(java.util.UUID) Test(org.junit.Test)

Example 8 with SSTableAddedNotification

use of org.apache.cassandra.notifications.SSTableAddedNotification in project eiger by wlloyd.

the class LeveledCompactionStrategy method handleNotification.

public void handleNotification(INotification notification, Object sender) {
    if (notification instanceof SSTableAddedNotification) {
        SSTableAddedNotification flushedNotification = (SSTableAddedNotification) notification;
        manifest.add(flushedNotification.added);
    } else if (notification instanceof SSTableListChangedNotification) {
        SSTableListChangedNotification listChangedNotification = (SSTableListChangedNotification) notification;
        manifest.promote(listChangedNotification.removed, listChangedNotification.added);
    }
}
Also used : SSTableListChangedNotification(org.apache.cassandra.notifications.SSTableListChangedNotification) SSTableAddedNotification(org.apache.cassandra.notifications.SSTableAddedNotification)

Aggregations

SSTableAddedNotification (org.apache.cassandra.notifications.SSTableAddedNotification)8 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)6 Test (org.junit.Test)6 UUID (java.util.UUID)5 Assert (org.junit.Assert)3 List (java.util.List)2 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 UpdateBuilder (org.apache.cassandra.UpdateBuilder)1 INotification (org.apache.cassandra.notifications.INotification)1 INotificationConsumer (org.apache.cassandra.notifications.INotificationConsumer)1 SSTableDeletingNotification (org.apache.cassandra.notifications.SSTableDeletingNotification)1 SSTableListChangedNotification (org.apache.cassandra.notifications.SSTableListChangedNotification)1 SSTableRepairStatusChanged (org.apache.cassandra.notifications.SSTableRepairStatusChanged)1