0

I am planning to upgrade cassandra version from 2.2 to 3.11. At the same time I want to change the existing table compaction strategy from SizeTieredCompactionStrategy to TimeWindow. I want to automate these two tasks. How do I change the compaction strategy while upgrading the cassandra version from 2.2x to 3.11x effectively?

I am running 3-node apache cassandra cluster as docker container holding timeseries data with 45 days TTL.

Consideration -

  1. Altering the compaction strategy for the table will trigger the compaction all across the nodes rewriting the SSTables.
  2. Major upgrade using "upgradesstables" command will lead to rewriting the SSTables due to storage engine change in cassandra 3.0

Is there any way to optimise this process by avoiding the rewriting of SSTables again and again.

Here is what I am thinking -

  1. Disable Compaction
  2. Alter the table to change the compaction
  3. Upgrade the Cassandra to 3.x
  4. Enable compaction

I am expecting upgradesstables will respect the new compaction and avoid one SSTable write.

Is this a correct approach?

Mac
  • 497
  • 5
  • 22
  • I agree with your two points in regards to what the documentation states. However, point 1, while that has been , and I'll use the word, suggested, int he documentation, is not what actually occurs. When you change the compaction strategy to, in your case, TWCS, an immediate rewrite of all existing sstables does NOT occur. New sstables will be created using the TWCS format and when you reach the limits you specified (X number of buckets), the old ones will drop off or get cleaned up. – Jim Wartnick Jul 16 '19 at 12:34
  • Even though it's possible, having two or more changes at the same time is not recommended: if something fails troubleshooting will be more difficult. If you have no other option than doing simultaneously, it would be better that you test it thoroughly first, we usually create a separate cluster from a restored backup, and apply the changes on it before doing the action on a "live" server. – Carlos Monroy Nieblas Jul 16 '19 at 17:53

1 Answers1

0

It looks like, we can avoid one compaction and save time in the above mentioned situation. The following steps eliminate the need for upgradesstables.

  • Upgrade to cassandra 3.x. Do not run upgradesstables.
  • Alter the table to change the compaction.

At the end of the compaction change, all the sstables get written in the new format eliminating need for upgradesstables command.

Mac
  • 497
  • 5
  • 22