Cassandra/TimeWindowCompactionStrategy

From Wikitech
Jump to navigation Jump to search

TimeWindowCompactionStrategy is an alternative to DateTieredCompactionStrategy, developed by Jeff Jirsa. It ships with Cassandra 3.0.7 and later, (where DateTieredCompactionStrategy has been officially deprecated). For Cassandra versions < 3.0.7, it is possible to install time-window compaction out-of-tree.

Source

Wikimedia maintains a Github branch of the repository, with the Maven pom.xml patched to deploy the jar to archiva.wikimedia.org.

Deployment

The compaction strategy is deployed from https://gerrit.wikimedia.org/r/#/admin/projects/operations/software/cassandra-twcs via Scap.

Updating the deploy repo

The deploy repository makes use of git-fat to sync the jar file to a working copy from Archiva, as necessary. If you need to deploy a new version of the strategy, the basic steps are:

  1. Build, and deploy to Archiva with Maven.
    $ cat ~/.m2/settings.xml
    <settings>
      <servers>
        <server>
          <id>wikimedia.releases</id>
          <username>archiva-deploy</username>
          <password>PASSWORD_GOES_HERE</password>
        </server>
        <server>
          <id>wikimedia.snapshots</id>
          <username>archiva-deploy</username>
          <password>PASSWORD_GOES_HERE</password>
        </server>
      </servers>
    </settings>
    $ mvn deploy
    ...
    
  2. Update the operations/software/cassandra-twcs with the jar
    $ cp /path/to/twcs/target/TimeWindowCompactionStrategy.jar lib/cassandra-v2.2
    $ git add lib/cassandra-v2.2/TimeWindowCompactionStrategy.jar
    $ git commit -m 'Adding TimeWindowCompactionStrategy.jar via git-fat'
    
    Note: Make sure that the jar you add to git is the same one uploaded in #1 (checksums should be matching). See Adding an artifact to your project for additional information.
  3. Deploy to the Cassandra nodes (see https://doc.wikimedia.org/mw-tools-scap/)
  4. Update the Cassandra classpath entries as necessary (cassandra::extra_classpath in Puppet hiera)