Commit 13398f9
Address PR feedback: nest MMapIndexInput, share MemoryMappedFile across slices
- Move MemoryMappedViewAccessorIndexInput into MMapDirectory.cs as the
internal nested MMapIndexInput class, per the repo convention of not
adding new files in Lucene-derived directories.
- Replace the slicer's manual dispose loop with
IOUtils.DisposeWhileHandlingException.
- Share one MemoryMappedFile + chunk array per file per MMapDirectory
instance via a refcounted SharedMapping tracked in a
ConcurrentDictionary<string, Lazy<SharedMapping>>. OpenInput,
CreateSlicer, its slices, and clones all piggyback on the same
underlying mapping; the mapping is torn down when the last referrer
disposes.
- Use bufferSize: 1 + RandomAccess | Asynchronous on all FileStream
creations since MemoryMappedFile bypasses the FileStream buffer.
- Add a FEATURE_CONCURRENTDICTIONARY_TRYREMOVE_KEYVALUEPAIR gate and a
polyfill in Support/ConcurrentDictionaryExtensions.cs for target
frameworks predating .NET 5, where the TryRemove(KeyValuePair)
overload is unavailable.
- Add TestSharedMappingLifecycle covering the end-to-end lifecycle of
the shared mapping across OpenInput, slicer, slices, and clones.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 681991d commit 13398f9
5 files changed
Lines changed: 793 additions & 499 deletions
File tree
- src
- Lucene.Net.Tests/Store
- Lucene.Net
- Store
- Support
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
232 | 305 | | |
233 | 306 | | |
234 | 307 | | |
| |||
0 commit comments