-
Notifications
You must be signed in to change notification settings - Fork 97
Add sharding support #1164
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
base: main
Are you sure you want to change the base?
Add sharding support #1164
Conversation
WalkthroughAdds an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this 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
🧹 Nitpick comments (1)
tests/client/test_client_multi_search_meilisearch.py (1)
107-107: Add assertion to verify sharding was configured.The response from
add_or_update_networksshould be validated to confirm that sharding was successfully enabled, similar to the assertion intest_client_network.pyline 37.Apply this diff to add the missing assertion:
assert "results" not in resp + assert resp["sharding"] is True assert "results" not in response
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
meilisearch/models/task.py(1 hunks)tests/client/test_client_multi_search_meilisearch.py(1 hunks)tests/client/test_client_network.py(1 hunks)tests/client/test_client_sharding.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/client/test_client_network.py (2)
tests/conftest.py (1)
client(15-16)meilisearch/client.py (1)
add_or_update_networks(779-799)
tests/client/test_client_sharding.py (2)
tests/conftest.py (1)
client(15-16)meilisearch/client.py (2)
add_or_update_networks(779-799)get_all_networks(801-814)
🔇 Additional comments (4)
tests/client/test_client_multi_search_meilisearch.py (1)
84-101: LGTM! Network configuration correctly includes sharding and writeApiKey fields.The addition of
"sharding": Trueand"writeApiKey"fields to the network configuration aligns with the PR's objective of introducing sharding support.tests/client/test_client_network.py (1)
17-37: LGTM! Test properly validates sharding configuration.The test correctly adds the
shardingflag andwriteApiKeyfields to the network configuration, and includes appropriate assertions to verify the response.tests/client/test_client_sharding.py (1)
1-35: LGTM! Comprehensive test coverage for sharding functionality.This new test file provides thorough validation of the sharding feature, including:
- Setting network configuration with sharding enabled
- Validating writeApiKey fields are properly stored and retrieved
- Confirming the sharding flag persists across update/get operations
meilisearch/models/task.py (1)
24-24: The Task.network field is correctly implemented and will deserialize from API responses.The field definition follows the correct pattern for optional generic dictionaries. When the network experimental feature is enabled, the field will contain replication metadata (origin or remotes data), and Pydantic will automatically deserialize it from the API response. The existing network tests in the codebase validate network configuration endpoints; the field itself will be populated transparently when tasks are retrieved.
d43103a to
48b1dd0
Compare
|
@jawad-khan thanks for your PR |
There was a problem hiding this 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
🧹 Nitpick comments (1)
tests/test_utils.py (1)
36-37: Helper implementation looks correct; consider minor clarity improvementsThe helper cleanly delegates to
client.add_or_update_networkswith a minimal payload and is appropriate for test reuse. To make its intent clearer to future readers, you might optionally add a short docstring and a return type hint (-> None), since this will likely be shared across multiple test modules.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
meilisearch/models/task.py(1 hunks)tests/client/test_client_multi_search_meilisearch.py(3 hunks)tests/client/test_client_network.py(2 hunks)tests/client/test_client_sharding.py(1 hunks)tests/test_utils.py(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- meilisearch/models/task.py
- tests/client/test_client_multi_search_meilisearch.py
- tests/client/test_client_network.py
- tests/client/test_client_sharding.py
🧰 Additional context used
🧬 Code graph analysis (1)
tests/test_utils.py (2)
tests/conftest.py (1)
client(15-16)meilisearch/client.py (1)
add_or_update_networks(779-799)
Pull Request
This PR introduces sharding support to the Meilisearch Python SDK. I have tested the sharding functionality locally using two remote nodes, and all related test cases passed successfully.
Related issue
Fixes #<1137>
What does this PR do?
As mentioned in the issue, I have tested all of these points locally and added tests for the parts that can be covered within the test suite.
PR checklist
Please check if your PR fulfills the following requirements:
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.