meticulous-dft opened a new pull request, #3158:
URL: https://github.com/apache/jackrabbit-oak/pull/3158

   ## Summary
   
   Since the connector was added to `oak-it-osgi` (cd3fc9262c), every build of 
this branch has failed in `OSGiIT.bundleStates`. The `oak-search-mongot` bundle 
stays `INSTALLED` because Felix cannot resolve it:
   
   ```text
   Unable to resolve org.apache.jackrabbit.oak-search-mongot: missing 
requirement
   osgi.wiring.package; 
(&(osgi.wiring.package=com.mongodb)(version>=5.4.0)(!(version>=6.0.0)))
   ```
   
   There were two causes, and the "embed" commit (8b449800cc) fixed only the 
first:
   
   - **`oak-search` classes.** The connector used them without embedding them. 
`oak-search` exports no packages (`Export-Package: !*`) and isn't deployed as a 
bundle, so those imports could never resolve. Inlining it, as `oak-lucene` and 
`oak-search-elastic` do, is correct and stays.
   - **MongoDB driver.** The added `*;scope=compile|runtime` clause embeds only 
direct dependencies. So it embedded `mongodb-driver-sync` but not the 
`mongodb-driver-core` and `bson` jars that it depends on, and about 30 
`com.mongodb.*` and 8 `org.bson.*` imports stayed unresolved. The same clause 
also matched `oak-search` and embedded it a second time as a nested jar.
   
   This PR stops embedding the driver and deploys the driver's own bundles in 
the OSGi test runtime, the way `oak-store-document` consumes the driver. The 
5.4.0 driver jars are proper OSGi bundles, with netty, snappy and zstd marked 
optional.
   
   ```diff
    oak-search-mongot/pom.xml
   -  <Embed-Dependency>oak-search;scope=compile|runtime;inline=true, 
*;scope=compile|runtime</Embed-Dependency>
   +  
<Embed-Dependency>oak-search;scope=compile|runtime;inline=true</Embed-Dependency>
    oak-it-osgi/test-bundles.xml
   +  <include>org.mongodb:bson</include>
   +  <include>org.mongodb:mongodb-driver-core</include>
   +  <include>org.mongodb:mongodb-driver-sync</include>
   ```
   
   The connector bundle is now 355 KB, with `oak-search` inlined and no 
embedded jars. It imports `com.mongodb` and `org.bson` in `[5.4,6)`, which wire 
to the driver bundles. The module README described importing the `oak-search` 
packages and driver 5.3, so that note is corrected.
   
   **Alternative considered.** Embedding the whole driver, like 
`oak-search-elastic` does with its client, also resolves. That needs 
`Embed-Transitive` plus exclusions for imports the driver never needs at 
runtime (GraalVM substitutions, JSR-305 annotations, `sun.misc` and 
`sun.nio.ch`). The result is a self-contained 3.3 MB bundle, but the exclusion 
list has to be maintained on every driver upgrade.
   
   **Deployment impact.** A runtime must provide MongoDB driver 5.x bundles, 
version 5.4 or later. Runtimes that already deploy the driver for the Document 
NodeStore satisfy this if their driver is 5.4 or newer.
   
   **Reviewer focus**
   
   - **Import range.** The `[5.4,6)` range comes from bnd's default for the 
5.4.0 compile dependency. `oak-store-document` declares `[5.2,5.5)` optionally, 
so a runtime with a 5.2 or 5.3 driver would resolve the Document NodeStore but 
not this connector.
   - **Test runtime.** `oak-store-document`'s optional MongoDB imports now also 
resolve in the `oak-it-osgi` runtime. All `oak-it-osgi` integration tests pass 
with that.
   
   ## Testing
   
   - Manually ran `oak-it-osgi`'s integration tests: all 14 pass, including 
`OSGiIT.bundleStates`, which failed before this change. A temporary PaxExam 
probe, not committed, also confirmed that the bundle is `ACTIVE`, that 
`MongotIndexImporter` registers, and that `MongotIndexProviderService` 
activates once configured.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to