lizhimins opened a new pull request, #10371:
URL: https://github.com/apache/rocketmq/pull/10371

   ## Summary
   
   - Make the native CqCompactionFilter shim fully self-contained by including 
stub vtable implementations for all platforms, eliminating the `DT_NEEDED` 
dependency on `librocksdbjni`
   - Remove `ensureRocksDBNativeLoaded()` from `CqCompactionFilterJni` — the 
shim no longer needs rocksdbjni loaded first
   - Add synchronized lifecycle management (`FILTER_LOCK`) with proper 
`destroyNativeFilter()` called in `preShutdown()`
   - Recompile all platform binaries (x86_64, aarch64, macOS arm64, Windows 
x64) with JDK 8 headers
   
   ## Motivation
   
   The previous shim had a `DT_NEEDED` on `librocksdbjni-linux64.so`. Since 
rocksdbjni has **no SONAME**, `dlopen` uses pathname-based dedup — different 
temp extraction paths produce different inodes, causing a second copy of 
rocksdbjni to be loaded into the process. Two copies of RocksDB global state 
(Env, thread pools) coexist, leading to intermittent SIGSEGV.
   
   ## Changes
   
   | File | Change |
   |------|--------|
   | `CqCompactionFilterJni.java` | Remove `ensureRocksDBNativeLoaded()`; add 
`FILTER_LOCK` + `destroyNativeFilter()`; simplify `loadNativeShim()` |
   | `ConsumeQueueRocksDBStorage.java` | Call 
`CqCompactionFilterJni.destroyNativeFilter()` in `preShutdown()` |
   | `cq_compaction_filter.cpp` | Remove `#ifdef _WIN32` guard on stubs — now 
unconditional for all platforms |
   | `libcq_compaction_filter.so` | Rebuilt x86_64 (self-contained, no 
DT_NEEDED on rocksdbjni) |
   | `libcq_compaction_filter_aarch64.so` | Rebuilt aarch64 (self-contained) |
   | `libcq_compaction_filter.dylib` | Rebuilt macOS arm64 (self-contained) |
   | `cq_compaction_filter.dll` | Rebuilt Windows x64 with MSVC 
(self-contained) |
   | `docs/en/Native_RocksDB.md` | Updated build instructions |
   
   ## Verification
   
   ```bash
   # Verify no rocksdbjni dependency
   objdump -p libcq_compaction_filter.so | grep NEEDED
   # Shows only: libstdc++, libm, libgcc_s, libc
   
   # CqCompactionFilterJniTest passed 5x on each platform:
   # - Linux x86_64 (JDK 8): 5/5 PASS
   # - Linux aarch64 (JDK 8): 5/5 PASS
   # - Windows x64 (JDK 8): 5/5 PASS
   ```
   
   ## Test plan
   - [x] `CqCompactionFilterJniTest` passes on Linux x86_64, aarch64, Windows 
x64, macOS arm64
   - [x] Full store module test suite passes (no regressions from this change)
   - [x] Repeated execution (5x per platform) shows no flakiness
   - [x] `objdump -p` confirms no DT_NEEDED on librocksdbjni
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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