Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(store/v2): use pebbledb in store tests #23213

Closed
wants to merge 1 commit into from

Conversation

robert-zaremba
Copy link
Collaborator

@robert-zaremba robert-zaremba commented Jan 7, 2025

Description

Based on CometBFT docs, goleveldb is deprecated, so let's use pebbledb as the default store/v2 backend in tests.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Configuration Update
    • Switched database backend from GoLevelDB to PebbleDB
    • Updated default database configuration for improved performance and storage management

Copy link
Contributor

coderabbitai bot commented Jan 7, 2025

📝 Walkthrough

Walkthrough

The pull request modifies the configuration file server/v2/testdata/config.toml by changing the database backend from GoLevelDB to PebbleDB. This configuration change suggests a transition to a different storage backend for the application, potentially to leverage specific performance or feature improvements offered by PebbleDB.

Changes

File Change Summary
server/v2/testdata/config.toml Updated database backend configuration from goleveldb to pebbledb

Possibly related PRs

Suggested labels

C:Store, C:server/v2

Suggested reviewers

  • kocubinski
  • cool-develope
  • tac0turtle
  • facundomedica

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the C:server/v2 Issues related to server/v2 label Jan 7, 2025
@julienrbrt
Copy link
Member

julienrbrt commented Jan 7, 2025

Disagree, especially that many chain won't start from scratch but upgrade. We've kept leveldb for testing for that reason (see comments in simapp custom config)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
server/v2/testdata/config.toml (1)

43-43: Consider adding a changelog entry

Since this changes the default database backend for tests, please add a changelog entry under the testing section to document this change.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f2bab5 and a1886df.

📒 Files selected for processing (1)
  • server/v2/testdata/config.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (1)
server/v2/testdata/config.toml (1)

43-43: Verify pebbledb support and migration path

While this change aligns with CometBFT's recommendation to move away from goleveldb, please verify:

  1. Is pebbledb fully supported in the current version?
  2. Are there any special build tags or dependencies required?
  3. What is the migration path for existing test databases?
✅ Verification successful

PebbleDB is fully supported but requires careful migration

  1. PebbleDB is fully implemented with production-ready features including concurrent compactions and configurable options.
  2. No special build tags required - just needs the github.com/cockroachdb/pebble dependency which is already included.
  3. For migrating test databases:
    • Stop the application
    • Back up your data directory
    • Change db_backend to "pebbledb"
    • Start with a fresh data directory for tests
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if pebbledb is imported and configured in the codebase
rg -l 'pebbledb|"pebble"' --type go

# Look for build tags or constraints related to pebbledb
rg -l '//\s*\+build.*pebble' --type go
rg -l '//go:build.*pebble' --type go

Length of output: 236


Script:

#!/bin/bash
# Check db.go implementation
cat store/v2/db/db.go

# Check go.mod for pebble dependency
cat go.mod | grep -i pebble

# Look for migration utilities or documentation
rg -l "migration|upgrade" --type md
rg -i "migrate.*leveldb.*pebble|upgrade.*leveldb.*pebble" --type go --type md

Length of output: 3451


Script:

#!/bin/bash
# Find NewPebbleDB implementation
rg -A 10 "func NewPebbleDB" --type go

# Look for any pebble-specific configuration
rg -i "pebble.*config|pebble.*options" --type go

Length of output: 1732

@@ -40,7 +40,7 @@ moniker = "aurn-node"
# * badgerdb (uses github.com/dgraph-io/badger)
# - EXPERIMENTAL
# - use badgerdb build tag (go build -tags badgerdb)
db_backend = "goleveldb"
db_backend = "pebbledb"
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update documentation to include pebbledb as a supported backend

The comment block above this line lists all supported database backends but doesn't include pebbledb. Please update the documentation to include information about pebbledb, its characteristics, and any build tags required.

@robert-zaremba
Copy link
Collaborator Author

@julienrbrt I understand your comment about existing chains, but we should prioritize test for the recommended setup. If goleveldb is marked deprecated, then we either have 2 tests, or use a non deprecated setting in the default test (which could mean to remove deprecation note for goleveldb).

@julienrbrt
Copy link
Member

@julienrbrt I understand your comment about existing chains, but we should prioritize test for the recommended setup. If goleveldb is marked deprecated, then we either have 2 tests, or use a non deprecated setting in the default test (which could mean to remove deprecation note for goleveldb).

Comet is testing all their dbs, we shouldn't have to test each of them ourselves again. We are testing ours.
The CometBFT db doesn't really affect the SDK features or potential issues. However it does affect our upgrade tests and shows as well how can the user change it. It is effectively only a simapp change.

@julienrbrt julienrbrt closed this Jan 7, 2025
@robert-zaremba
Copy link
Collaborator Author

There was a bug that was not detected, until I tried to use PebbleDB. So, if we want to test goleveldb by default, maybe we should do a smoke test with PebbleDB?

@robert-zaremba robert-zaremba deleted the robert/tests-use-pebbledb branch January 7, 2025 17:35
@julienrbrt
Copy link
Member

If we do not have any we should probably have a systemtest with pebbledb yes, but we are talking about the SDK db and not the cometbft db (which was what this PR was doing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:server/v2 Issues related to server/v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants