Repository navigation
fix(cluster): name the sharding-state shard the way the server sends it - #622
Open
dudanogueira wants to merge 2 commits into
Open
dudanogueira wants to merge 2 commits into
dudanogueira wants to merge 2 commits into
Conversation
ShardReplica carried no @SerializedName, so Gson looked for the field's own name, shardName. The server sends "shard" (entities/models/replication_shard_replicas.go), so the component was null on every server version and a sharding-state response could not identify its shards. The client installs its own field-naming strategy (JSON.java:74 -> PropertyFieldNamingStrategy -> PojoDescriptor.propertyName), which honours only the ORM @Property annotation and otherwise returns the field name -- so the expected key really was "shardName". "replicas" matched by coincidence, the field name and the wire name agreeing; it is annotated here too so the record no longer depends on that. The Java component keeps its name: @SerializedName bridges it without a breaking rename. No alternate spelling -- nothing was ever stored or sent as "shardName". Closes #621 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HNeKV7TAYZGDyT9agqJwUf
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
Collaborator
|
Please remove all comments from this PR and trim the PR description to what is strictly relevant. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the shard JSON mapping change.
No open issues 🎉
What changed in this PR
Fixes #621 by mapping the server’s shard JSON key to ShardReplica.shardName, preserving the existing Java API.
Changes:
- Adds explicit JSON field names for
shardNameandreplicas. - Adds a
ShardingStateJSON test case using the server’s response format.
| File | Description |
|---|---|
src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java |
Adds regression coverage for shard names and replicas. |
src/main/java/io/weaviate/client6/v1/api/cluster/ShardReplica.java |
Annotates record components with their JSON field names. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The server sends the shard name in a sharding-state response as
shard, butShardReplica.shardNamehad no@SerializedName, so it was alwaysnull. This annotates the field and adds aJSONTestrow forShardingState.Closes #621