1. create a class that extends AbstractCompactionStrategy (i would keep it
in-tree while developing to avoid having classpath issues etc)
2. Implement the abstract methods
   - getNextBackgroundTask - called when cassandra wants to do a new minor
(background) compaction - return a CompactionTask with the sstables you
want compacted
   - getMaximalTask - called when a user triggers a major compaction
   - getUserDefinedTask - when a user triggers a user defined compaction
from JMX
   - getEstimatedRemainingTasks - return the guessed number of tasks before
we are "done"
   - getMaxSSTableBytes - if your compaction strategy puts a limit on the
size of sstables
3. Execute this in cqlsh to enable your compaction strategy: ALTER TABLE
foo WITH compaction = { class: ‘Bar’ }
4. Things to think about:
    - make sure you mark sstables as compacting before returning them from
the compaction strategy (and check the return value!):
https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java#L271
    - if you do this on 2.1 - dont mix repaired and unrepaired sstables
(SSTableReader#isRepaired)

Let me know if you need any more information

/Marcus



On Thu, Sep 4, 2014 at 6:50 PM, Ghosh, Mainak <mgho...@illinois.edu> wrote:

> Hello,
>
> I am planning to write a new compaction strategy and I was hoping if
> anyone can point me to the relevant functions and how they are related in
> the call hierarchy.
>
> Thanks for the help.
>
> Regards,
> Mainak.
>

Reply via email to