mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Perf ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description When looking at the local shard, if the collection was cached when the table was created then the local shard was never registered and those backends saw degraded perf - this fixes it. ---- #### AI description (iteration 1) #### PR Classification Bug fix to address local shard pushdown not working in all cases. #### PR Summary This pull request fixes issues with local shard pushdown by ensuring proper handling of shard names and remote shard status. - `src/metadata/collection.c`: Added `TrySetCollectionShard` function to handle shard name setting and remote status. - `src/distribution/distributed_hooks.c`: Updated `TryGetShardNameForUnshardedCollectionCore` to return empty string instead of NULL in specific cases and added logging. - `include/metadata/collection.h`: Added `isShardRemote` field to `MongoCollection` struct. - `include/api_hooks.h`: Updated documentation for `TryGetShardNameForUnshardedCollection` to reflect new return values. - `src/commands/aggregation_commands.c`: Minor change to use `DatumGetTextPP` instead of `DatumGetTextP`.