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

feat: remove build tag for pebbledb #117

Merged
merged 4 commits into from
Nov 22, 2024
Merged

feat: remove build tag for pebbledb #117

merged 4 commits into from
Nov 22, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Nov 22, 2024

Helps cosmos/cosmos-sdk#22577.
CometBFT / Comet-DB now has pebbledb by default this now aligns with this so that our users do not need a build flag.

Summary by CodeRabbit

Release Notes for Version 1.1.0

  • New Features

    • Enhanced flexibility of the Iteractor and Batch interfaces.
    • Introduced PebbleDBBackend as a valid database backend type.
  • Bug Fixes

    • Removed deprecated testing targets, streamlining the testing process.
    • Updated handling of synchronous operations to improve database performance.
  • Documentation

    • Updated changelog to reflect the release and previous versions, including important upgrade notes.
  • Chores

    • Upgraded Go version and updated various dependencies for improved performance and compatibility.

Copy link
Contributor

coderabbitai bot commented Nov 22, 2024

Walkthrough

The changes in this pull request encompass updates to various files, including the CHANGELOG.md, Makefile, db.go, go.mod, pebble.go, and pebble_test.go. The CHANGELOG.md reflects the release of version 1.1.0, highlighting enhancements to interfaces and dependency adjustments. The Makefile simplifies testing commands by removing specific targets and tags. The db.go file introduces a new constant for the Pebble database backend, while go.mod updates the Go version and several dependencies. Lastly, modifications in pebble.go and pebble_test.go streamline synchronous operation handling and adjust test configurations.

Changes

File Change Summary
CHANGELOG.md Updated to version 1.1.0; added type alias for Iteractor and Batch, removed PebbleDB alias.
Makefile Removed test-pebble and test-all targets; updated test target by removing -tags pebbledb.
db.go Added constant PebbleDBBackend; removed previous declaration with comments.
go.mod Updated Go version to 1.19; multiple dependency updates; added indirect dependency github.com/cockroachdb/fifo.
pebble.go Removed //go:build pebbledb directive; modified ForceSync handling and comments.
pebble_test.go Removed //go:build pebbledb directive; commented out TestPebbleDBStats function.

Poem

In the meadow, changes sprout,
New versions dance, there's no doubt.
With Pebble's grace, we leap and bound,
In code's embrace, joy is found.
Hops of progress, swift and bright,
Celebrate the code, a wondrous sight! 🐇✨


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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@julienrbrt julienrbrt marked this pull request as ready for review November 22, 2024 15:30
@julienrbrt julienrbrt requested a review from a team as a code owner November 22, 2024 15:30
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: 0

🧹 Outside diff range and nitpick comments (3)
Makefile (1)

6-7: Consider updating the comment to reflect the change

The comment above the test target mentions "By default this will only test memdb, goleveldb, and pebbledb", but since pebbledb tests now run without tags, this comment should be updated.

-## By default this will only test memdb, goleveldb, and pebbledb, which do not require cgo
+## By default this will run all tests except those requiring cgo (like rocksdb)
db.go (1)

20-20: Fix documentation typo

There's a duplicate "DB" in the comment. Change "PebbleDBDBBackend" to "PebbleDBBackend" to maintain consistency with the actual constant name.

-// PebbleDBDBBackend represents pebble (uses github.com/cockroachdb/pebble)
+// PebbleDBBackend represents pebble (uses github.com/cockroachdb/pebble)
pebble.go (1)

Line range hint 144-148: Consider documenting performance implications

The sync/nosync behavior controlled by ForceSync affects write performance in Set, Delete, and Write operations. Consider adding a comment about the performance trade-offs between durability and speed when ForceSync is enabled.

Example documentation:

 var (
+	// ForceSync controls write durability. When set to "1", all write operations
+	// use Sync mode, providing stronger durability guarantees at the cost of
+	// slower write performance. Default "0" uses NoSync for better performance.
 	ForceSync   = "0"
 	isForceSync = false
 )

Also applies to: 182-186, 284-288

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ddc3f09 and 5a33ca2.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • Makefile (1 hunks)
  • db.go (1 hunks)
  • go.mod (1 hunks)
  • pebble.go (2 hunks)
  • pebble_test.go (0 hunks)
💤 Files with no reviewable changes (1)
  • pebble_test.go
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[grammar] ~6-~6: Adverb repetition.
Context: ...tch` interfaces more flexible by a type alias * Remove alias for PebbleDB ## [v1.0.2] - 2024-02-26 ...

(ADVERB_VERB_ADVERB_REPETITION)

🔇 Additional comments (8)
Makefile (1)

7-7: Verify the impact of removing pebbledb build tag

The simplified test command aligns with removing the pebbledb build tag. However, let's verify that all pebble-related tests are properly configured to run without the tag.

✅ Verification successful

Removing pebbledb build tag is consistent with codebase changes

The removal of the -tags pebbledb flag from the test command is appropriate because:

  • The PR removes dedicated pebble-specific test targets (test-pebble and test-all)
  • Pebble-related files (pebble.go, pebble_test.go) remain in the codebase
  • No build tag constraints for pebble were found in the codebase
  • The change aligns with the Makefile comment that states tests will run for "memdb, goleveldb, and pebbledb" by default

This indicates that pebble tests are now part of the default test suite without requiring explicit build tags, which is the intended behavior.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining build tag dependencies and test configurations

# Check for any remaining pebbledb build tags
echo "Checking for any remaining pebbledb build tags..."
rg "//go:build.*pebbledb" 

# Check for test files that might be affected
echo "Checking for test files that might need updates..."
rg -l "pebbledb" --type go --type test

Length of output: 315


Script:

#!/bin/bash
# Let's try a different approach to check for pebble-related tests and build tags

# Check for any remaining build tags in go files
echo "Checking for build tags..."
rg "//\s*\+build.*pebble" 

# Check for pebble-related test files
echo "Checking for pebble-related test files..."
fd -e go -x rg -l "pebble" {}

# Check Makefile history to understand the context better
echo "Checking Makefile changes..."
git diff HEAD^1 Makefile

Length of output: 1008

db.go (1)

20-22: LGTM! Removal of build tags aligns with making pebble a standard backend

The simplification of the PebbleDB constant definition and its documentation aligns well with the PR objective of removing the build tag for pebbledb. This change effectively promotes pebble to be a standard backend alongside goleveldb and others.

go.mod (4)

14-15: Verify pinned goleveldb dependency.

The comment explains why syndtr/goleveldb is pinned to a specific version. This is good practice for documenting version constraints.


18-44: Review indirect dependency updates for security and compatibility.

Significant version jumps in indirect dependencies:

  • DataDog/zstd: v1.4.5 -> v1.5.6
  • getsentry/sentry-go: v0.18.0 -> v0.29.1
  • klauspost/compress: v1.15.15 -> v1.17.11
  • prometheus packages updated to latest versions
✅ Verification successful

Based on the changelog information and security vulnerability check results, I can now provide a final response:

Indirect dependency updates appear safe to proceed with

  • No security vulnerabilities found in the updated dependencies
  • Changes are primarily bug fixes and improvements:
    • DataDog/zstd (v1.5.6): Fixes decompression buffer sizing and large payload handling
    • getsentry/sentry-go (v0.29.1): Contains error correlation fixes and trace context improvements
    • klauspost/compress (v1.17.11): Includes fixes for CRC handling and content-type headers

Note: The breaking change in sentry-go v0.29.0 (removal of sentrymartini integration) doesn't impact this project as the integration isn't used.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any known vulnerabilities in the updated dependencies
gh api graphql -f query='
{
  securityVulnerabilities(first: 10, ecosystem: GO, package: "github.com/DataDog/zstd") {
    nodes {
      advisory {
        summary
        severity
      }
      vulnerableVersionRange
    }
  }
}'

# Check for any deprecated APIs or breaking changes
for pkg in "DataDog/zstd" "getsentry/sentry-go" "klauspost/compress"; do
    echo "Checking $pkg changelog..."
    gh api repos/${pkg}/releases --jq '.[0:2].[].body'
done

Length of output: 7250


3-5: Verify Go version and toolchain compatibility.

The toolchain version (go1.23.1) is newer than the Go version (1.22.0) specified. While this works, it's unconventional and might cause confusion. Consider either:

  1. Upgrading Go version to 1.23
  2. Or removing the toolchain directive if not specifically needed
✅ Verification successful

Go version and toolchain configuration appears safe to use

The codebase doesn't use any Go 1.22-specific features, and the build constraints are only used for conditional compilation of RocksDB-related code. While the toolchain version (1.23.1) is newer than the Go version (1.22.0), this is actually a supported configuration as the toolchain is backward compatible. The Go version specified is sufficient for the current codebase needs.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if any Go files use features requiring Go 1.22 or newer
rg -l 'any|clear|min|max|clear|contains|copy|deleteFunc|indexOf|lastIndexOf' --type go

# Check for potential compatibility issues in dependencies
go list -m -json all | jq -r '.Path + " " + .Version' | while read -r dep ver; do
    if [[ $ver == *"v0.0.0"* ]]; then
        echo "Pseudo-version detected: $dep $ver"
    fi
done

Length of output: 419


Script:

#!/bin/bash
# Let's check for specific Go 1.22+ features more precisely
rg -A 2 '\bslices\.' --type go  # slices package was expanded in 1.22
rg -A 2 '\bmaps\.' --type go    # maps package was expanded in 1.22
rg -A 2 '\bclear\(' --type go   # clear builtin was added in 1.22
rg -A 2 'range.*clear' --type go # range clear syntax was added in 1.22

# Check if there are any build constraints or minimum Go version requirements
rg -l '^//\s*\+build' --type go
rg -l '^//go:build' --type go

Length of output: 324


Script:

#!/bin/bash
# Let's check the content of build constraints to understand version requirements
rg '^//go:build' -A 1 rocksdb*.go

# Check for any direct usage of Go 1.22+ features in the codebase
# Looking for specific method calls that were introduced in 1.22
rg '\b(slices\.(Max|Min|Clone|Contains)|maps\.(Clone|Copy|DeleteFunc)|clear\()' --type go

Length of output: 464


8-12: Verify breaking changes in core dependency updates.

Several direct dependencies have been updated with potentially breaking changes:

  • pebble: v1.1.0 -> v1.1.2
  • grocksdb: v1.8.12 -> v1.9.7
  • btree: v1.1.2 -> v1.1.3
✅ Verification successful

Let me gather more information about how these dependencies are used in the codebase to better assess the impact of the updates.


Let me check the actual API usage to ensure there are no breaking changes.


Minor version updates appear safe to proceed

Based on the analysis of dependency usage and version changes:

  • Pebble v1.1.0 -> v1.1.2: Minor version update with dependency updates and MIPS fix
  • grocksdb v1.8.12 -> v1.9.7: Adapts to RocksDB 9.7.3, adds missing read tiers, no breaking API changes visible
  • btree v1.1.2 -> v1.1.3: Minor version update with no changelog indicating breaking changes

The codebase uses standard APIs from these libraries (DB operations, iterators, options) that are stable across these minor version updates. No deprecated or removed API usage patterns were detected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any API changes in the updated dependencies
for pkg in "github.com/cockroachdb/pebble" "github.com/linxGnu/grocksdb" "github.com/google/btree"; do
    echo "Checking $pkg changelog/releases..."
    gh api repos/${pkg#github.com/}/releases --jq '.[0:2].[].body'
done

Length of output: 1616


Script:

#!/bin/bash
# Check usage of pebble, grocksdb, and btree in the codebase
echo "Checking pebble usage..."
rg "github.com/cockroachdb/pebble" -B 2 -A 2

echo -e "\nChecking grocksdb usage..."
rg "github.com/linxGnu/grocksdb" -B 2 -A 2

echo -e "\nChecking btree usage..."
rg "github.com/google/btree" -B 2 -A 2

# Check for any test failures or compilation issues in recent commits
echo -e "\nChecking recent commit messages for any related issues..."
git log --grep="pebble\|grocksdb\|btree" --since="1 month ago" --oneline

Length of output: 5343


Script:

#!/bin/bash
# Check specific API usage patterns for each dependency

echo "Checking pebble API usage..."
ast-grep --pattern 'pebble.$_' 

echo -e "\nChecking grocksdb API usage..."
ast-grep --pattern 'grocksdb.$_'

echo -e "\nChecking btree API usage..."
ast-grep --pattern 'btree.$_'

# Also check imports to see the scope of usage
echo -e "\nChecking import patterns..."
rg "^import.*pebble|^import.*grocksdb|^import.*btree" -A 3

Length of output: 2185

pebble.go (2)

35-35: LGTM: Clear upgrade instructions

The installation commands correctly demonstrate the upgrade process, showing when to use ForceSync during upgrades and when it can be omitted for normal operation.

Also applies to: 45-45


Line range hint 53-54: LGTM: Clean ForceSync implementation

The ForceSync configuration is well-implemented with:

  • Thread-safe initialization at startup
  • Efficient caching of the parsed value
  • Clear boolean flag for runtime checks

Also applies to: 61-65

go.mod Outdated Show resolved Hide resolved
@julienrbrt julienrbrt changed the title feat: remove build tag for pebbledb feat: remove build tag for pebbledb + bump rocksdb Nov 22, 2024
@julienrbrt julienrbrt changed the title feat: remove build tag for pebbledb + bump rocksdb feat: remove build tag for pebbledb Nov 22, 2024
github.com/cockroachdb/pebble v1.1.0
github.com/google/btree v1.1.2
github.com/cockroachdb/pebble v1.1.2
github.com/google/btree v1.1.3
github.com/linxGnu/grocksdb v1.8.12
Copy link
Member Author

Choose a reason for hiding this comment

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

cometbft-db bumped this, we may not want to do that in the same release line as it may break stuff.

julienrbrt added a commit to cosmos/cosmos-sdk that referenced this pull request Nov 22, 2024
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: 0

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.md (1)

5-6: Consider improving grammar in the interface change description.

The article usage could be improved for better clarity.

-* Make `Iteractor` and `Batch` interfaces more flexible by a type alias
+* Make `Iteractor` and `Batch` interfaces more flexible by the type alias
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1bdfe54 and 366eae0.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~7-~7: You might be missing the article “the” here.
Context: ... more flexible by a type alias * Remove build tag for PebbleDB ## [v1.0.2] - 2024-02...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🔇 Additional comments (1)
CHANGELOG.md (1)

3-3: LGTM!

The version header follows proper semantic versioning format and ISO 8601 date standard.

@julienrbrt julienrbrt merged commit 5b0eddd into main Nov 22, 2024
2 of 3 checks passed
@julienrbrt julienrbrt deleted the julien/pebbledb branch November 22, 2024 16:26
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.

3 participants