Skip to content

Conversation

@arvindKandpal-ksolves
Copy link
Contributor

Currently, nodetool compactionhistory does not provide visibility into the specific type of compaction (e.g., Major, Minor, Validation) or the compaction strategy used (e.g., STCS, LCS). Additionally, the output displays raw bytes by default, which is difficult to read.

This patch enhances the compaction history by persisting the compaction type and strategy properties into the system.compaction_history table and exposing them via nodetool.

Changes included in this patch:

  1. Schema Update: Added compaction_type column to system.compaction_history.
  2. Logic Update: Updated CompactionTask to capture the compaction type (e.g., Major, Cleanup) and strategy class (e.g., SizeTieredCompactionStrategy) and persist them.
  3. JMX/Tooling: Updated CompactionHistoryTabularData and nodetool compactionhistory printer to display these new fields.
  4. UX Improvement: Changed nodetool compactionhistory to display human-readable sizes (KiB, MiB) by default. Added a -n / --no-human-readable flag to revert to raw bytes.
  5. Tests: Updated SystemKeyspaceTest, CompactionTaskTest, and CompactionHistoryTest to cover schema changes and verify the persistence of new fields.

Tests Performed:

  • ant test -Dtest.name=SystemKeyspaceTest (PASSED)
  • ant test -Dtest.name=CompactionTaskTest (PASSED)
  • ant test -Dtest.name=CompactionHistoryTest (PASSED)
  • Manual verification using nodetool compactionhistory on a local node.

patch by arvindKandpal-ksolves ; for CASSANDRA-20081

Copy link
Contributor

@jyothsnakonisa jyothsnakonisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left few comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check SystemKeyspaceMigrator41.java? specifically migrateCompactionHistory() method. You might need to include compaction_type during migration.

@arvindKandpal-ksolves arvindKandpal-ksolves force-pushed the CASSANDRA-20081-enhance-compaction-history branch from 21d8883 to 519ea81 Compare January 8, 2026 07:53
@arvindKandpal-ksolves
Copy link
Contributor Author

@jyothsnakonisa Thanks for the review. I have addressed all your comments:

  1. Reverted nodetool flag changes to maintain backward compatibility.
  2. Updated SystemKeyspaceMigrator41 and fixed upgrade tests.
  3. Fixed code style, imports, and cleanup issues.
  4. Ready for re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants