Skip to content

Support apple silicon and fix NPE in tests #1183

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

Closed
wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 18, 2025

I tried to run the project tests for the first time, but they failed. I found two reasons and fixed them:

The jna.version = 5.5.0 version does not support Apple Silicon processors. So I updated the version to 5.7.0.
The BaseLogStorageTest#testTruncatePrefix test failed with a NullPointerException inside the ThreadPoolsFactory#runInThread method when accessing a ConcurrentHashMap with key == null. To fix this, I added a call to the LogStorageOptions.setGroupId("test") method before running the tests.

Summary by CodeRabbit

  • Chores
    • Updated the overall system version to 1.3.16 across components.
    • Upgraded a key supporting dependency to version 5.7.0.
  • Tests
    • Enhanced test configuration by explicitly setting a group identifier to improve log storage evaluation.

Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Walkthrough

This pull request updates the parent version in several Maven POM files from 1.3.15.bugfix to 1.3.16 across various modules (including core, example, extensions, and tests). In addition, the root pom.xml now updates the project version and bumps the jna dependency from 5.5.0 to 5.7.0. A test class method in the log storage implementation has been enhanced to set a groupId property.

Changes

File(s) Change Summary
jraft-core/pom.xml, jraft-example/pom.xml, jraft-extension/{bdb-log-storage-impl, java-log-storage-impl, rpc-grpc-impl}/pom.xml, jraft-extension/pom.xml, jraft-rheakv/{pom.xml, rheakv-core/pom.xml, rheakv-pd/pom.xml}, jraft-test/pom.xml Updated parent version from 1.3.15.bugfix to 1.3.16
pom.xml (root) Updated project version from 1.3.15.bugfix to 1.3.16 and bumped <jna.version> from 5.5.0 to 5.7.0
jraft-extension/bdb-log-storage-impl/src/test/java/.../BaseLogStorageTest.java Added opts.setGroupId("test"); in the newLogStorageOptions method

Possibly related PRs

Poem

I'm a hopping rabbit in the code-filled glen,
Leaping through POM files again and again.
Versions updated with a swift little test,
"test" group in place—simple and blessed.
I wiggle my nose for changes done right! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9029048 and 45dd682.

📒 Files selected for processing (12)
  • jraft-core/pom.xml (1 hunks)
  • jraft-example/pom.xml (1 hunks)
  • jraft-extension/bdb-log-storage-impl/pom.xml (1 hunks)
  • jraft-extension/bdb-log-storage-impl/src/test/java/com/alipay/sofa/jraft/storage/impl/BaseLogStorageTest.java (1 hunks)
  • jraft-extension/java-log-storage-impl/pom.xml (1 hunks)
  • jraft-extension/pom.xml (1 hunks)
  • jraft-extension/rpc-grpc-impl/pom.xml (1 hunks)
  • jraft-rheakv/pom.xml (1 hunks)
  • jraft-rheakv/rheakv-core/pom.xml (1 hunks)
  • jraft-rheakv/rheakv-pd/pom.xml (1 hunks)
  • jraft-test/pom.xml (1 hunks)
  • pom.xml (2 hunks)
✅ Files skipped from review due to trivial changes (5)
  • jraft-extension/pom.xml
  • jraft-test/pom.xml
  • jraft-rheakv/pom.xml
  • jraft-extension/bdb-log-storage-impl/pom.xml
  • jraft-rheakv/rheakv-pd/pom.xml
🔇 Additional comments (8)
jraft-extension/bdb-log-storage-impl/src/test/java/com/alipay/sofa/jraft/storage/impl/BaseLogStorageTest.java (1)

72-72:

❓ Verification inconclusive

LGTM! Setting groupId fixes the NPE.

The addition of opts.setGroupId("test") is a good fix for the NullPointerException in ThreadPoolsFactory#runInThread. This ensures that all test cases have a valid groupId, which is a required field.

Let's verify that this is the only place where LogStorageOptions is created:


🏁 Script executed:

#!/bin/bash
# Search for other LogStorageOptions instantiations
ast-grep --pattern 'new LogStorageOptions()'

Length of output: 1213


LGTM – GroupId Fix Verified, but Please Double-Check Other Test Instantiations

The addition of opts.setGroupId("test") in BaseLogStorageTest.java clearly fixes the NullPointerException seen in ThreadPoolsFactory#runInThread during test execution. Our search confirms that while this change addresses the failure in this particular test, there are several other files (e.g., in jraft-core and java-log-storage-impl) where new LogStorageOptions() is instantiated. Please verify that these other instantiations either don’t encounter the same NPE or are intentionally left without a specific groupId value.

  • File: jraft-extension/bdb-log-storage-impl/src/test/java/com/alipay/sofa/jraft/storage/impl/BaseLogStorageTest.java (Line 72) – GroupId is now set.
  • Other Instantiations: Multiple occurrences in different modules were identified. Confirm that these are unaffected by the NPE issue or update them if necessary.
jraft-extension/java-log-storage-impl/pom.xml (1)

7-7: LGTM! Version update is consistent.

The version update to 1.3.16 aligns with the coordinated version updates across all modules.

jraft-extension/rpc-grpc-impl/pom.xml (1)

7-7: LGTM! Version update is consistent.

The version update to 1.3.16 aligns with the coordinated version updates across all modules.

jraft-rheakv/rheakv-core/pom.xml (1)

7-7: LGTM! Version update is consistent.

The version update to 1.3.16 aligns with the coordinated version updates across all modules.

jraft-example/pom.xml (1)

8-8: Parent Version Update Confirmed
The parent version has been correctly updated to 1.3.16. Ensure this change is consistently propagated across all module POMs for version alignment.

jraft-core/pom.xml (1)

8-8: Parent Version Update Confirmed
The parent version is now 1.3.16, which matches the coordinated update across modules. This consistency is important for project management and release coordination.

pom.xml (2)

7-7: Global Parent Version Update
The global project version in the parent POM has been updated to 1.3.16. This update aligns with all module changes and supports a coordinated release cycle.


66-66: JNA Dependency Version Upgrade for Apple Silicon Support
The <jna.version> property has been upgraded from 5.5.0 to 5.7.0. This change is critical for supporting Apple Silicon processors. Please verify that this new version is fully compatible with all runtime environments used by the project.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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.

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.

@ghost ghost closed this Mar 17, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants