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 ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description 1) For wildcard term generation, we were iterating every array twice (once for the array term and once for the array path term). Instead, iterate the array once and generate the terms together 2) We were also enumerating every array a 3rd time to count the keys - estimate key term count by using a log2(size) 3) Add the new stages for currentOp index tracking 4) Use dynamic_library_path to avoid specifying load library path in hosted environments (this also fixes parallel build for the internal index POC) ---- #### AI description (iteration 1) #### PR Classification Code cleanup and performance improvement. #### PR Summary This pull request focuses on improving the indexing mechanism for BSON documents in the Gin index. - `bson_gin_core.c`: Refactored `GenerateTermsCore` function to split logic into `GenerateArrayPath` and `GenerateTermPath` for better readability and maintainability. - Enhanced term generation for arrays and nested documents to optimize index lookup and query performance. - Improved memory management by using `StringInfo` for path construction and ensuring proper buffer allocation. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->