How to Check and Upgrade Cassandra SSTable Format

Here is a nice (external) blog that explains the different SSTable formats by Cassandra version number: http://www.bajb.net/2013/03/cassandra-sstable-format-version-numbers/

From the Apigee Private Cloud installation, you can check the SSTable format by going to the directory

/<install-root>/apigee4/data/cassandra/data

Run this find command from the directory,

find . -name *-ic-* 

If you get *.db files as responses returned from this command, then you are running Cassandra 1.2 SSTable format.

find . -name *-hf-* 

If you get *.db files as responses returned from this command, then you are running Cassandra 1.1 SSTable format.

find . -name *-jb-*

If you get *.db files as a response returned from this command, then you are running Cassandra 2.0 SSTable format.

Note snapshot directories are where older version SSTable db files are archived, and .sha1 extension files can be ignored when checking your SSTable format.

If you find that your version of Cassandra and the SSTable format do not match. i.e. you are running Cassandra 1.2 and you have SSTable files with the format of *-hf-*, then you should run the nodetool command to upgrade your SSTable format.

We recommend:

1. clearing out old snapshot files,

nodetool clearsnapshot

2. taking a snapshot of your keyspaces as backup.

nodetool snapshot -t <snapshotName>

3. Upgrade the SSTable if you found SSTable format files from previous versions of Cassandra

nodetool -h <ipaddr> upgradesstables -a

NOTE: the upgradesstables command will come back immediately on the command line without any messages. It will be running in the background and may need time to complete. Depending on the size of your data, it may take a few minutes to a few hours to run in the background.

Rerun the find commands above to check if the db files have been converted. If there are still old SSTable format files left, you can try to rerun the nodetool upgradestables command until all db files are upgraded.

4. The upgradsstables command will need to be run serially on each Cassandra node in the cluster.

Comments
taka-t
Participant II

Hi jhunt,

I want to try the upgrade process, but I found that the recovery procedure from snapshot seems to be a little bit complicate so i do not want to do the recovery procedure for all the key paces of Private Cloud.

So, I want to just re-install and run nodetool repair as mentioned below if the upgrade procedure fails.

https://docs.apigee.com/private-cloud/latest/how-reinstall-and-restore-components#apachecassandra-re...

Is it a possible alternative to the recovery way using snapshots?

Regards,

Not applicable

Nice explanation! In case if you are looking to understand how Cassandra reads SSTables, check out the source code of its implementation https://zgrepcode.com/cassandra/apache/3.11/org/apache/cassandra/io/sstable/format/sstablereader.jav...

Version history
Last update:
‎11-16-2015 03:01 PM
Updated by: