Changing repair strategies
Change the method used for routine repairs from incremental or full repair. Repairing SSTables using anti-entropy repair is required for database maintenance. A full repair of all SSTables on a node takes a lot of time and is resource-intensive. Incremental repair consumes less time and resources because it skips SSTables that are already marked as repaired.
Migrating to full repairs
Incremental repairs split the data into repaired and unrepaired SSTables and mark the data state with metadata. Full repairs keeps the data together and uses no repair status flag.
Before switching from incremental repairs to full repairs remove the repaired status:
nodetool mark_unrepaired KEYSPACE_NAME TABLE_NAME
Migrating to incremental repairs
To start using incremental repairs, migrate the SSTables on each node. Incremental repair skips SSTables that are already marked as repaired. These steps ensure the data integrity when changing the repair strategy from full to incremental.
|
DataStax recommends using full repairs. Incremental repairs can cause performance issues. See CASSANDRA-9143. However, be aware that the first system-wide full repair can take a long time while the database recompacts all SSTables. To make this process less disruptive, migrate the cluster to incremental repair one node at a time. |
-
Disable autocompaction on the node.
Running
nodetool disableautocompactionwithout parameters disables autocompaction for all keyspaces:nodetool disableautocompactionFor tarball installations, run this command from the
/bindirectory of your DSE installation. -
Before running a full repair in the next step, list the nodes SSTables located in
/var/lib/cassandra/data. You need this list to run the command to set therepairedAtflag later in this process when you mark the tables as repaired.The
datadirectory contains a subdirectory for each keyspace. Each subdirectory contains a set of files for each SSTable. The name of the file that contains the SSTable data has the formatVERSION_CODE-GENERATION-FORMAT-Data.db. -
Run the default full, sequential repair on one node at a time.
Running
nodetool repairwithout parameters runs a full sequential repair of all SSTables on the node and can take a substantial amount of time:nodetool repairFor tarball installations, run this command from the
/bindirectory of your DSE installation. -
Using the list you created earlier in this process, set the
repairedAtflag on each SSTable usingsstablerepairedsetwith the--is-repairedoption.If you don’t set
repairedAtto--is-repairedfor each SSTable, the existing SSTables might not be changed by the repair process, and any incremental repair processes that run later won’t process these SSTables.To mark a single SSTable as repaired, run the following command, replacing
SSTABLE_NAME_DATA_FILE_NAMEwith the actual SSTable data file name (VERSION_CODE-GENERATION-FORMAT-Data.db):sudo sstablerepairedset --really-set --is-repaired SSTABLE_DATA_FILE_NAMEFor batch processing, use a text file of SSTable names:
sudo sstablerepairedset --really-set --is-repaired -f SSTable-names.txtFor tarball installations, run these commands from the
/resources/cassandra/tools/bindirectory of your DSE installation.The value of the
repairedAtflag is the timestamp of the last repair. Thesstablerepairedsetcommand sets the timestamp the current date/time when you run the command. To check the value of therepairedAtflag, usesstablemetadata:sstablemetadata KEYSPACE_NAME-SSTABLE_DATA_FILE_NAME | grep "Repaired at" -
After you have migrated all nodes, you can run incremental repairs using
nodetool repairwith the-incoption.