Skip to content

Feat/update store to latest version#2

Open
PaddyMc wants to merge 11 commits intomasterfrom
feat/update-store-to-latest-version
Open

Feat/update store to latest version#2
PaddyMc wants to merge 11 commits intomasterfrom
feat/update-store-to-latest-version

Conversation

@PaddyMc
Copy link
Copy Markdown

@PaddyMc PaddyMc commented Mar 19, 2025

Update the store version, store-specific pruning and version checking

Overview

This PR adds two key features to the Cosmos-Pruner tool:

  1. Ability to prune individual stores within the application database
  2. Enhanced store version checking and analysis capabilities

Key Features

1. Bumping the store version

Bumped the store version to allow for pruning correctly

2. Individual Store Pruning

Added new prune-store command that allows targeting specific stores for pruning:

cosmprund prune-store [path_to_home] [store_name]

This enables more granular control over database pruning, allowing operators to:

  • Prune specific problematic stores
  • Maintain different pruning strategies for different stores
  • Reduce disk space usage selectively

3. Enhanced Store Version Analysis

Added new check-store-versions command that provides detailed analysis of store versions:

cosmprund check-store-versions [path_to_home]

The analysis includes:

  • Version count per store
  • Version gaps identification
  • Detection of stores with excessive versions
  • First and last version tracking

Technical Details

Store Version Analysis

The new analysis system:

  1. Collects version statistics for each store:

    type storeStats struct {
        name         string
        versionCount int
        firstVersion int64
        lastVersion  int64
        versionGap   int64
    }
  2. Identifies potential issues:

    • Stores with more than 1.5x the average version count
    • Stores with large version gaps (>80% of max gap)
    • Inconsistent pruning patterns
  3. Provides detailed reporting:

    Store 'store_name': X versions (latest: Y, exists: true/false)
    

Individual Store Pruning

The new pruning functionality:

  1. Validates store existence and type
  2. Performs targeted version deletion
  3. Handles compaction after pruning
  4. Maintains store integrity during operations

Usage Examples

Check Store Versions

# Check all store versions
cosmprund check-store-versions ~/.osmosisd/data

# Example output:
Store 'auth': 150 versions (latest: 1000, exists: true)
Store 'bank': 120 versions (latest: 1000, exists: true)

Prune Specific Store

# Prune a specific store
cosmprund prune-store ~/.osmosisd/data auth

# Example output:
pruning store: auth
Store auth: 150 versions (latest: 1000, exists: true)
pruning store auth complete

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.

1 participant